Index: sdk/lib/_internal/pub/lib/src/barback/build_environment.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/barback/build_environment.dart b/sdk/lib/_internal/pub/lib/src/barback/build_environment.dart |
index f155374d7bf82e536e4d270da6a1223cda9cdfea..730c927ea6e383424506027b175d0830a1ec52b6 100644 |
--- a/sdk/lib/_internal/pub/lib/src/barback/build_environment.dart |
+++ b/sdk/lib/_internal/pub/lib/src/barback/build_environment.dart |
@@ -139,13 +139,13 @@ class BuildEnvironment { |
/// Starts up the admin server on an appropriate port and returns it. |
/// |
/// This may only be called once on the build environment. |
- Future<AdminServer> startAdminServer() { |
+ Future<AdminServer> startAdminServer([int port]) { |
// Can only start once. |
assert(_adminServer == null); |
- // The admin server is bound to one before the base port, unless it's |
- // ephemeral in which case the admin port is too. |
- var port = _basePort == 0 ? 0 : _basePort - 1; |
+ // The admin server is bound to one before the base port by default, unless |
+ // it's ephemeral in which case the admin port is too. |
+ if (port == null) port = _basePort == 0 ? 0 : _basePort - 1; |
return AdminServer.bind(this, _hostname, port) |
.then((server) => _adminServer = server); |