forked from firka/flutter
[flutter_tools] throw a tool exit if pub cannot be run (#83293)
This commit is contained in:
@@ -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];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user