| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:io'; | 6 import 'dart:io'; |
| 7 | 7 |
| 8 import 'package:args/args.dart'; | 8 import 'package:args/args.dart'; |
| 9 import 'package:http/http.dart' as http; | 9 import 'package:http/http.dart' as http; |
| 10 import 'package:path/path.dart' as path; | 10 import 'package:path/path.dart' as path; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 | 168 |
| 169 // Make sure there aren't unexpected arguments. | 169 // Make sure there aren't unexpected arguments. |
| 170 if (!command.takesArguments && options.rest.isNotEmpty) { | 170 if (!command.takesArguments && options.rest.isNotEmpty) { |
| 171 command.usageError( | 171 command.usageError( |
| 172 'Command "${options.name}" does not take any arguments.'); | 172 'Command "${options.name}" does not take any arguments.'); |
| 173 } | 173 } |
| 174 | 174 |
| 175 return syncFuture(() { | 175 return syncFuture(() { |
| 176 return command.run(cacheDir, options); | 176 return command.run(cacheDir, mainOptions, options); |
| 177 }).whenComplete(() { | 177 }).whenComplete(() { |
| 178 command.cache.deleteTempDir(); | 178 command.cache.deleteTempDir(); |
| 179 }); | 179 }); |
| 180 } | 180 } |
| 181 | 181 |
| 182 /// Checks that pub is running on a supported platform. | 182 /// Checks that pub is running on a supported platform. |
| 183 /// | 183 /// |
| 184 /// If it isn't, it prints an error message and exits. Completes when the | 184 /// If it isn't, it prints an error message and exits. Completes when the |
| 185 /// validation is done. | 185 /// validation is done. |
| 186 Future validatePlatform() { | 186 Future validatePlatform() { |
| 187 return syncFuture(() { | 187 return syncFuture(() { |
| 188 if (Platform.operatingSystem != 'windows') return null; | 188 if (Platform.operatingSystem != 'windows') return null; |
| 189 | 189 |
| 190 return runProcess('ver', []).then((result) { | 190 return runProcess('ver', []).then((result) { |
| 191 if (result.stdout.join('\n').contains('XP')) { | 191 if (result.stdout.join('\n').contains('XP')) { |
| 192 log.error('Sorry, but pub is not supported on Windows XP.'); | 192 log.error('Sorry, but pub is not supported on Windows XP.'); |
| 193 return flushThenExit(exit_codes.USAGE); | 193 return flushThenExit(exit_codes.USAGE); |
| 194 } | 194 } |
| 195 }); | 195 }); |
| 196 }); | 196 }); |
| 197 } | 197 } |
| OLD | NEW |