| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /// The main entrypoint for the pub command line application. | 5 /// The main entrypoint for the pub command line application. |
| 6 library pub; | 6 library pub; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import '../../pkg/args/lib/args.dart'; | 9 import '../../pkg/args/lib/args.dart'; |
| 10 import '../../pkg/path/lib/path.dart' as path; | 10 import '../../pkg/path/lib/path.dart' as path; |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 if (commandFuture == null) return true; | 271 if (commandFuture == null) return true; |
| 272 | 272 |
| 273 return commandFuture; | 273 return commandFuture; |
| 274 }).whenComplete(() => cache_.deleteTempDir()).catchError((asyncError) { | 274 }).whenComplete(() => cache_.deleteTempDir()).catchError((asyncError) { |
| 275 var e = asyncError.error; | 275 var e = asyncError.error; |
| 276 if (e is PubspecNotFoundException && e.name == null) { | 276 if (e is PubspecNotFoundException && e.name == null) { |
| 277 e = 'Could not find a file named "pubspec.yaml" in the directory ' | 277 e = 'Could not find a file named "pubspec.yaml" in the directory ' |
| 278 '${path.current}.'; | 278 '${path.current}.'; |
| 279 } else if (e is PubspecHasNoNameException && e.name == null) { | 279 } else if (e is PubspecHasNoNameException && e.name == null) { |
| 280 e = 'pubspec.yaml is missing the required "name" field (e.g. "name: ' | 280 e = 'pubspec.yaml is missing the required "name" field (e.g. "name: ' |
| 281 '${basename(path.current)}").'; | 281 '${path.basename(path.current)}").'; |
| 282 } | 282 } |
| 283 | 283 |
| 284 handleError(e, asyncError.stackTrace); | 284 handleError(e, asyncError.stackTrace); |
| 285 }).then((_) { | 285 }).then((_) { |
| 286 // Explicitly exit on success to ensure that any dangling dart:io handles | 286 // Explicitly exit on success to ensure that any dangling dart:io handles |
| 287 // don't cause the process to never terminate. | 287 // don't cause the process to never terminate. |
| 288 exit(0); | 288 exit(0); |
| 289 }); | 289 }); |
| 290 } | 290 } |
| 291 | 291 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 316 if (exception is HttpException || exception is HttpParserException || | 316 if (exception is HttpException || exception is HttpParserException || |
| 317 exception is SocketIOException || exception is PubHttpException) { | 317 exception is SocketIOException || exception is PubHttpException) { |
| 318 return exit_codes.UNAVAILABLE; | 318 return exit_codes.UNAVAILABLE; |
| 319 } else if (exception is FormatException) { | 319 } else if (exception is FormatException) { |
| 320 return exit_codes.DATA; | 320 return exit_codes.DATA; |
| 321 } else { | 321 } else { |
| 322 return 1; | 322 return 1; |
| 323 } | 323 } |
| 324 } | 324 } |
| 325 } | 325 } |
| OLD | NEW |