Commit 3e2a4d9b authored by Eric Seidel's avatar Eric Seidel

`flutter run` should fail if `pub get` fails.

Previously we were ignoring the return code and continuing.

@devoncarew
parent 8f603800
...@@ -81,8 +81,11 @@ class RunCommand extends RunCommandBase { ...@@ -81,8 +81,11 @@ class RunCommand extends RunCommandBase {
@override @override
Future<int> run() async { Future<int> run() async {
if (argResults['pub']) if (argResults['pub']) {
await pubGet(); int exitCode = await pubGet();
if (exitCode != 0)
return exitCode;
}
return await super.run(); return await super.run();
} }
......
...@@ -15,6 +15,8 @@ Future<int> _runPub(Directory directory, { bool upgrade: false }) async { ...@@ -15,6 +15,8 @@ Future<int> _runPub(Directory directory, { bool upgrade: false }) async {
for (FileSystemEntity dir in directory.listSync()) { for (FileSystemEntity dir in directory.listSync()) {
if (dir is Directory && FileSystemEntity.isFileSync(dir.path + Platform.pathSeparator + 'pubspec.yaml')) { if (dir is Directory && FileSystemEntity.isFileSync(dir.path + Platform.pathSeparator + 'pubspec.yaml')) {
updateCount++; 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); await pubGet(directory: dir.path, upgrade: upgrade, checkLastModified: false);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment