Index: sdk/lib/_internal/pub/lib/src/barback/asset_environment.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/barback/asset_environment.dart b/sdk/lib/_internal/pub/lib/src/barback/asset_environment.dart |
index a8a56f0df048f8eb2b6c84f1ae24643a9ddb241e..bfd97b35aff834ff353ff2fe77ff0d46f067d7b0 100644 |
--- a/sdk/lib/_internal/pub/lib/src/barback/asset_environment.dart |
+++ b/sdk/lib/_internal/pub/lib/src/barback/asset_environment.dart |
@@ -184,10 +184,14 @@ class AssetEnvironment { |
/// 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(int port) { |
+ Future<AdminServer> startAdminServer([int port]) { |
// Can only start once. |
assert(_adminServer == null); |
+ // 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); |
} |