| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 'Command "${options.name}" does not take any arguments.'); | 192 'Command "${options.name}" does not take any arguments.'); |
| 193 } | 193 } |
| 194 | 194 |
| 195 return syncFuture(() { | 195 return syncFuture(() { |
| 196 return command.run(cacheDir, options); | 196 return command.run(cacheDir, options); |
| 197 }).whenComplete(() { | 197 }).whenComplete(() { |
| 198 command.cache.deleteTempDir(); | 198 command.cache.deleteTempDir(); |
| 199 }); | 199 }); |
| 200 } | 200 } |
| 201 | 201 |
| 202 /// Checks that pub is running on a supported platform. If it isn't, it prints | 202 /// Checks that pub is running on a supported platform. |
| 203 /// an error message and exits. Completes when the validation is done. | 203 /// |
| 204 /// If it isn't, it prints an error message and exits. Completes when the |
| 205 /// validation is done. |
| 204 Future validatePlatform() { | 206 Future validatePlatform() { |
| 205 return syncFuture(() { | 207 return syncFuture(() { |
| 206 if (Platform.operatingSystem != 'windows') return null; | 208 if (Platform.operatingSystem != 'windows') return null; |
| 207 | 209 |
| 208 return runProcess('ver', []).then((result) { | 210 return runProcess('ver', []).then((result) { |
| 209 if (result.stdout.join('\n').contains('XP')) { | 211 if (result.stdout.join('\n').contains('XP')) { |
| 210 log.error('Sorry, but pub is not supported on Windows XP.'); | 212 log.error('Sorry, but pub is not supported on Windows XP.'); |
| 211 return flushThenExit(exit_codes.USAGE); | 213 return flushThenExit(exit_codes.USAGE); |
| 212 } | 214 } |
| 213 }); | 215 }); |
| 214 }); | 216 }); |
| 215 } | 217 } |
| OLD | NEW |