Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
302e992c
Unverified
Commit
302e992c
authored
May 24, 2021
by
Jonah Williams
Committed by
GitHub
May 24, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] throw a tool exit if pub cannot be run (#83293)
parent
5c3f5a7a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
5 deletions
+36
-5
pub.dart
packages/flutter_tools/lib/src/dart/pub.dart
+11
-5
pub_get_test.dart
...s/flutter_tools/test/general.shard/dart/pub_get_test.dart
+25
-0
No files found.
packages/flutter_tools/lib/src/dart/pub.dart
View file @
302e992c
...
...
@@ -148,7 +148,8 @@ class _DefaultPub implements Pub {
_processUtils
=
ProcessUtils
(
logger:
logger
,
processManager:
processManager
,
);
),
_processManager
=
processManager
;
final
FileSystem
_fileSystem
;
final
Logger
_logger
;
...
...
@@ -156,6 +157,7 @@ class _DefaultPub implements Pub {
final
Platform
_platform
;
final
BotDetector
_botDetector
;
final
Usage
_usage
;
final
ProcessManager
_processManager
;
@override
Future
<
void
>
get
({
...
...
@@ -391,11 +393,15 @@ class _DefaultPub implements Pub {
'cache'
,
'dart-sdk'
,
'bin'
,
if
(
_platform
.
isWindows
)
'pub.bat'
else
'pub'
'pub'
,
]);
if
(!
_processManager
.
canRun
(
sdkPath
))
{
throwToolExit
(
'Your Flutter SDK download may be corrupt or missing permissions to run. '
'Try re-downloading the Flutter SDK into a directory that has read/write '
'permissions for the current user.'
);
}
return
<
String
>[
sdkPath
,
...
arguments
];
}
...
...
packages/flutter_tools/test/general.shard/dart/pub_get_test.dart
View file @
302e992c
...
...
@@ -22,6 +22,31 @@ void main() {
Cache
.
flutterRoot
=
''
;
});
testWithoutContext
(
'Throws a tool exit if pub cannot be run'
,
()
async
{
final
FakeProcessManager
processManager
=
FakeProcessManager
.
empty
();
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
MemoryFileSystem
fileSystem
=
MemoryFileSystem
.
test
();
processManager
.
excludedExecutables
.
add
(
'bin/cache/dart-sdk/bin/pub'
);
fileSystem
.
file
(
'pubspec.yaml'
).
createSync
();
final
Pub
pub
=
Pub
(
fileSystem:
fileSystem
,
logger:
logger
,
processManager:
processManager
,
usage:
TestUsage
(),
platform:
FakePlatform
(
environment:
const
<
String
,
String
>{},
),
botDetector:
const
BotDetectorAlwaysNo
(),
);
await
expectLater
(()
=>
pub
.
get
(
context:
PubContext
.
pubGet
,
checkUpToDate:
true
,
),
throwsToolExit
(
message:
'Your Flutter SDK download may be corrupt or missing permissions to run'
));
});
testWithoutContext
(
'checkUpToDate skips pub get if the package config is newer than the pubspec '
'and the current framework version is the same as the last version'
,
()
async
{
final
FakeProcessManager
processManager
=
FakeProcessManager
.
empty
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment