| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 246 |
| 247 /// Checks that pub is running on a supported platform. | 247 /// Checks that pub is running on a supported platform. |
| 248 /// | 248 /// |
| 249 /// If it isn't, it prints an error message and exits. Completes when the | 249 /// If it isn't, it prints an error message and exits. Completes when the |
| 250 /// validation is done. | 250 /// validation is done. |
| 251 Future validatePlatform() { | 251 Future validatePlatform() { |
| 252 final completer0 = new Completer(); | 252 final completer0 = new Completer(); |
| 253 scheduleMicrotask(() { | 253 scheduleMicrotask(() { |
| 254 try { | 254 try { |
| 255 join0() { | 255 join0() { |
| 256 runProcess('ver', []).then((x0) { | 256 new Future.value(runProcess('ver', [])).then((x0) { |
| 257 try { | 257 try { |
| 258 var result = x0; | 258 var result = x0; |
| 259 join1() { | 259 join1() { |
| 260 completer0.complete(); | 260 completer0.complete(); |
| 261 } | 261 } |
| 262 if (result.stdout.join('\n').contains('XP')) { | 262 if (result.stdout.join('\n').contains('XP')) { |
| 263 log.error('Sorry, but pub is not supported on Windows XP.'); | 263 log.error('Sorry, but pub is not supported on Windows XP.'); |
| 264 flushThenExit(exit_codes.USAGE).then((x1) { | 264 new Future.value(flushThenExit(exit_codes.USAGE)).then((x1) { |
| 265 try { | 265 try { |
| 266 x1; | 266 x1; |
| 267 join1(); | 267 join1(); |
| 268 } catch (e0, s0) { | 268 } catch (e0, s0) { |
| 269 completer0.completeError(e0, s0); | 269 completer0.completeError(e0, s0); |
| 270 } | 270 } |
| 271 }, onError: completer0.completeError); | 271 }, onError: completer0.completeError); |
| 272 } else { | 272 } else { |
| 273 join1(); | 273 join1(); |
| 274 } | 274 } |
| 275 } catch (e1, s1) { | 275 } catch (e1, s1) { |
| 276 completer0.completeError(e1, s1); | 276 completer0.completeError(e1, s1); |
| 277 } | 277 } |
| 278 }, onError: completer0.completeError); | 278 }, onError: completer0.completeError); |
| 279 } | 279 } |
| 280 if (Platform.operatingSystem != 'windows') { | 280 if (Platform.operatingSystem != 'windows') { |
| 281 completer0.complete(null); | 281 completer0.complete(null); |
| 282 } else { | 282 } else { |
| 283 join0(); | 283 join0(); |
| 284 } | 284 } |
| 285 } catch (e, s) { | 285 } catch (e, s) { |
| 286 completer0.completeError(e, s); | 286 completer0.completeError(e, s); |
| 287 } | 287 } |
| 288 }); | 288 }); |
| 289 return completer0.future; | 289 return completer0.future; |
| 290 } | 290 } |
| OLD | NEW |