| 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 d2aa3ebd4db3de8c32f3ffafe76ac186668ac4aa..ad6a567b6f9fcfe3eeae49286e2efdde503f1ead 100644
|
| --- a/sdk/lib/_internal/pub/lib/src/command/serve.dart
|
| +++ b/sdk/lib/_internal/pub/lib/src/command/serve.dart
|
| @@ -27,9 +27,19 @@ class ServeCommand extends PubCommand {
|
|
|
| PubPackageProvider _provider;
|
|
|
| + String get hostname => commandOptions['hostname'];
|
| +
|
| ServeCommand() {
|
| commandParser.addOption('port', defaultsTo: '8080',
|
| help: 'The port to listen on.');
|
| +
|
| + // A hidden option for the tests to work around a bug in some of the OS X
|
| + // bots where "localhost" very rarely resolves to the IPv4 loopback address
|
| + // instead of IPv6 (or vice versa). The tests will always set this to
|
| + // 127.0.0.1.
|
| + commandParser.addOption('hostname',
|
| + defaultsTo: 'localhost',
|
| + hide: true);
|
| }
|
|
|
| Future onRun() {
|
| @@ -44,7 +54,7 @@ class ServeCommand extends PubCommand {
|
|
|
| return ensureLockFileIsUpToDate()
|
| .then((_) => entrypoint.loadPackageGraph())
|
| - .then((graph) => barback.createServer("localhost", port, graph))
|
| + .then((graph) => barback.createServer(hostname, port, graph))
|
| .then((server) {
|
| /// This completer is used to keep pub running (by not completing) and
|
| /// to pipe fatal errors to pub's top-level error-handling machinery.
|
| @@ -85,7 +95,7 @@ class ServeCommand extends PubCommand {
|
| });
|
|
|
| log.message("Serving ${entrypoint.root.name} "
|
| - "on http://localhost:${server.port}");
|
| + "on http://$hostname:${server.port}");
|
|
|
| return completer.future;
|
| });
|
|
|