Chromium Code Reviews| 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..dbab7a4a3c68fd5e4209fd40e15aca5e20450d83 100644 |
| --- a/sdk/lib/_internal/pub/lib/src/command/serve.dart |
| +++ b/sdk/lib/_internal/pub/lib/src/command/serve.dart |
| @@ -27,9 +27,18 @@ 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. |
|
Bob Nystrom
2013/09/24 22:42:19
Do we have an actual bug for this? We should file
nweiz
2013/09/24 22:54:36
Since this looks like an OS X bug, I don't think i
|
| + commandParser.addOption('hostname', defaultsTo: 'localhost', |
| + isHidden: true); |
|
Bob Nystrom
2013/09/24 22:42:19
Will be "hide" once your other patch is in.
nweiz
2013/09/24 22:54:36
Done.
|
| } |
| Future onRun() { |
| @@ -44,7 +53,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 +94,7 @@ class ServeCommand extends PubCommand { |
| }); |
| log.message("Serving ${entrypoint.root.name} " |
| - "on http://localhost:${server.port}"); |
| + "on http://$hostname:${server.port}"); |
| return completer.future; |
| }); |