| Index: sdk/lib/_internal/pub/lib/src/command/serve.dart
|
| diff --git a/sdk/lib/_internal/pub/lib/src/command/serve.dart b/sdk/lib/_internal/pub/lib/src/command/serve.dart
|
| index d1149bc17fb88956c8e78e1711f125dca6b6a223..d2aa3ebd4db3de8c32f3ffafe76ac186668ac4aa 100644
|
| --- a/sdk/lib/_internal/pub/lib/src/command/serve.dart
|
| +++ b/sdk/lib/_internal/pub/lib/src/command/serve.dart
|
| @@ -11,6 +11,7 @@ import '../barback.dart' as barback;
|
| import '../command.dart';
|
| import '../entrypoint.dart';
|
| import '../exit_codes.dart' as exit_codes;
|
| +import '../io.dart';
|
| import '../log.dart' as log;
|
| import '../utils.dart';
|
|
|
| @@ -32,7 +33,14 @@ class ServeCommand extends PubCommand {
|
| }
|
|
|
| Future onRun() {
|
| - var port = parsePort();
|
| + var port;
|
| + try {
|
| + port = int.parse(commandOptions['port']);
|
| + } on FormatException catch (_) {
|
| + log.error('Could not parse port "${commandOptions['port']}"');
|
| + this.printUsage();
|
| + return flushThenExit(exit_codes.USAGE);
|
| + }
|
|
|
| return ensureLockFileIsUpToDate()
|
| .then((_) => entrypoint.loadPackageGraph())
|
| @@ -97,15 +105,4 @@ class ServeCommand extends PubCommand {
|
| }
|
| });
|
| }
|
| -
|
| - /// Parses the `--port` command-line argument and exits if it isn't valid.
|
| - int parsePort() {
|
| - try {
|
| - return int.parse(commandOptions['port']);
|
| - } on FormatException catch(_) {
|
| - log.error('Could not parse port "${commandOptions['port']}"');
|
| - this.printUsage();
|
| - exit(exit_codes.USAGE);
|
| - }
|
| - }
|
| }
|
|
|