| 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:path/path.dart' as path; | 10 import 'package:path/path.dart' as path; | 
| 10 import 'package:stack_trace/stack_trace.dart'; | 11 import 'package:stack_trace/stack_trace.dart'; | 
| 11 | 12 | 
| 12 import '../lib/src/command.dart'; | 13 import '../lib/src/command.dart'; | 
| 13 import '../lib/src/exit_codes.dart' as exit_codes; | 14 import '../lib/src/exit_codes.dart' as exit_codes; | 
| 14 import '../lib/src/http.dart'; | 15 import '../lib/src/http.dart'; | 
| 15 import '../lib/src/io.dart'; | 16 import '../lib/src/io.dart'; | 
| 16 import '../lib/src/log.dart' as log; | 17 import '../lib/src/log.dart' as log; | 
| 17 import '../lib/src/sdk.dart' as sdk; | 18 import '../lib/src/sdk.dart' as sdk; | 
| 18 import '../lib/src/utils.dart'; | 19 import '../lib/src/utils.dart'; | 
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 129   }).then((_) { | 130   }).then((_) { | 
| 130     // Explicitly exit on success to ensure that any dangling dart:io handles | 131     // Explicitly exit on success to ensure that any dangling dart:io handles | 
| 131     // don't cause the process to never terminate. | 132     // don't cause the process to never terminate. | 
| 132     return flushThenExit(exit_codes.SUCCESS); | 133     return flushThenExit(exit_codes.SUCCESS); | 
| 133   }); | 134   }); | 
| 134 } | 135 } | 
| 135 | 136 | 
| 136 /// Returns the appropriate exit code for [exception], falling back on 1 if no | 137 /// Returns the appropriate exit code for [exception], falling back on 1 if no | 
| 137 /// appropriate exit code could be found. | 138 /// appropriate exit code could be found. | 
| 138 int chooseExitCode(exception) { | 139 int chooseExitCode(exception) { | 
| 139   if (exception is HttpException || exception is HttpException || | 140   if (exception is HttpException || exception is http.ClientException || | 
| 140       exception is SocketException || exception is PubHttpException) { | 141       exception is SocketException || exception is PubHttpException) { | 
| 141     return exit_codes.UNAVAILABLE; | 142     return exit_codes.UNAVAILABLE; | 
| 142   } else if (exception is FormatException || exception is DataException) { | 143   } else if (exception is FormatException || exception is DataException) { | 
| 143     return exit_codes.DATA; | 144     return exit_codes.DATA; | 
| 144   } else if (exception is UsageException) { | 145   } else if (exception is UsageException) { | 
| 145     return exit_codes.USAGE; | 146     return exit_codes.USAGE; | 
| 146   } else { | 147   } else { | 
| 147     return 1; | 148     return 1; | 
| 148   } | 149   } | 
| 149 } | 150 } | 
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 208     if (Platform.operatingSystem != 'windows') return null; | 209     if (Platform.operatingSystem != 'windows') return null; | 
| 209 | 210 | 
| 210     return runProcess('ver', []).then((result) { | 211     return runProcess('ver', []).then((result) { | 
| 211       if (result.stdout.join('\n').contains('XP')) { | 212       if (result.stdout.join('\n').contains('XP')) { | 
| 212         log.error('Sorry, but pub is not supported on Windows XP.'); | 213         log.error('Sorry, but pub is not supported on Windows XP.'); | 
| 213         return flushThenExit(exit_codes.USAGE); | 214         return flushThenExit(exit_codes.USAGE); | 
| 214       } | 215       } | 
| 215     }); | 216     }); | 
| 216   }); | 217   }); | 
| 217 } | 218 } | 
| OLD | NEW | 
|---|