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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 if (commandFuture == null) return true; | 264 if (commandFuture == null) return true; |
265 | 265 |
266 return commandFuture; | 266 return commandFuture; |
267 }).whenComplete(() => cache_.deleteTempDir()).catchError((asyncError) { | 267 }).whenComplete(() => cache_.deleteTempDir()).catchError((asyncError) { |
268 var e = asyncError.error; | 268 var e = asyncError.error; |
269 if (e is PubspecNotFoundException && e.name == null) { | 269 if (e is PubspecNotFoundException && e.name == null) { |
270 e = 'Could not find a file named "pubspec.yaml" in the directory ' | 270 e = 'Could not find a file named "pubspec.yaml" in the directory ' |
271 '${path.current}.'; | 271 '${path.current}.'; |
272 } else if (e is PubspecHasNoNameException && e.name == null) { | 272 } else if (e is PubspecHasNoNameException && e.name == null) { |
273 e = 'pubspec.yaml is missing the required "name" field (e.g. "name: ' | 273 e = 'pubspec.yaml is missing the required "name" field (e.g. "name: ' |
274 '${basename(path.current)}").'; | 274 '${path.basename(path.current)}").'; |
275 } | 275 } |
276 | 276 |
277 handleError(e, asyncError.stackTrace); | 277 handleError(e, asyncError.stackTrace); |
278 }).then((_) { | 278 }).then((_) { |
279 // Explicitly exit on success to ensure that any dangling dart:io handles | 279 // Explicitly exit on success to ensure that any dangling dart:io handles |
280 // don't cause the process to never terminate. | 280 // don't cause the process to never terminate. |
281 exit(0); | 281 exit(0); |
282 }); | 282 }); |
283 } | 283 } |
284 | 284 |
(...skipping 24 matching lines...) Expand all Loading... |
309 if (exception is HttpException || exception is HttpParserException || | 309 if (exception is HttpException || exception is HttpParserException || |
310 exception is SocketIOException || exception is PubHttpException) { | 310 exception is SocketIOException || exception is PubHttpException) { |
311 return exit_codes.UNAVAILABLE; | 311 return exit_codes.UNAVAILABLE; |
312 } else if (exception is FormatException) { | 312 } else if (exception is FormatException) { |
313 return exit_codes.DATA; | 313 return exit_codes.DATA; |
314 } else { | 314 } else { |
315 return 1; | 315 return 1; |
316 } | 316 } |
317 } | 317 } |
318 } | 318 } |
OLD | NEW |