Chromium Code Reviews| Index: sdk/lib/_internal/pub/bin/pub.dart |
| diff --git a/sdk/lib/_internal/pub/bin/pub.dart b/sdk/lib/_internal/pub/bin/pub.dart |
| index 8f7fa4e32ddb192e82476c190c4953617b49973d..46f5b712d13c399b1174f0e1f9bc0262bddbf403 100644 |
| --- a/sdk/lib/_internal/pub/bin/pub.dart |
| +++ b/sdk/lib/_internal/pub/bin/pub.dart |
| @@ -129,7 +129,7 @@ int chooseExitCode(exception) { |
| } |
| /// Walks the command tree and runs the selected pub command. |
| -Future invokeCommand(String cacheDir, ArgResults mainOptions) { |
| +Future invokeCommand(String cacheDir, ArgResults mainOptions) async { |
|
nweiz
2014/08/29 22:27:39
I think we should omit the return type annotation
Bob Nystrom
2014/08/29 23:03:20
Actually, that's not why we omit it for setters. T
nweiz
2014/08/29 23:30:41
Despite the fact that the parser considers "async"
Bob Nystrom
2014/09/03 23:44:16
I don't think it's part of the signature and I'm q
nweiz
2014/09/05 18:57:38
I'm not saying it's literally part of the signatur
|
| var commands = PubCommand.mainCommands; |
| var command; |
| var commandString = "pub"; |
| @@ -174,26 +174,23 @@ Future invokeCommand(String cacheDir, ArgResults mainOptions) { |
| 'Command "${options.name}" does not take any arguments.'); |
| } |
| - return syncFuture(() { |
| + try { |
| return command.run(cacheDir, mainOptions, options); |
|
nweiz
2014/08/29 22:27:39
I also think we should prefer "await" to "return"
Bob Nystrom
2014/08/29 23:03:20
Done and agreed. When converting the vanilla code
|
| - }).whenComplete(() { |
| + } finally { |
| command.cache.deleteTempDir(); |
| - }); |
| + } |
| } |
| /// Checks that pub is running on a supported platform. |
| /// |
| /// If it isn't, it prints an error message and exits. Completes when the |
| /// validation is done. |
| -Future validatePlatform() { |
| - return syncFuture(() { |
| - if (Platform.operatingSystem != 'windows') return null; |
| - |
| - return runProcess('ver', []).then((result) { |
| - if (result.stdout.join('\n').contains('XP')) { |
| - log.error('Sorry, but pub is not supported on Windows XP.'); |
| - return flushThenExit(exit_codes.USAGE); |
| - } |
| - }); |
| - }); |
| +Future validatePlatform() async { |
| + if (Platform.operatingSystem != 'windows') return; |
| + |
| + var result = await runProcess('ver', []); |
| + if (result.stdout.join('\n').contains('XP')) { |
| + log.error('Sorry, but pub is not supported on Windows XP.'); |
| + return flushThenExit(exit_codes.USAGE); |
| + } |
| } |