flutter run should fail if pub get fails.

Previously we were ignoring the return code and continuing.

@devoncarew
This commit is contained in:
Eric Seidel 2016-03-10 09:32:25 -08:00
parent 8f603800ba
commit 3e2a4d9b4d
2 changed files with 7 additions and 2 deletions

View File

@ -81,8 +81,11 @@ class RunCommand extends RunCommandBase {
@override
Future<int> run() async {
if (argResults['pub'])
await pubGet();
if (argResults['pub']) {
int exitCode = await pubGet();
if (exitCode != 0)
return exitCode;
}
return await super.run();
}

View File

@ -15,6 +15,8 @@ Future<int> _runPub(Directory directory, { bool upgrade: false }) async {
for (FileSystemEntity dir in directory.listSync()) {
if (dir is Directory && FileSystemEntity.isFileSync(dir.path + Platform.pathSeparator + 'pubspec.yaml')) {
updateCount++;
// TODO(eseidel): Should this fail immediately if pubGet fails?
// Currently we're ignoring the return code.
await pubGet(directory: dir.path, upgrade: upgrade, checkLastModified: false);
}
}