UNPKG

854 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const denodeify = require("denodeify");
4const SilentError = require('silent-error');
5const PortFinder = require('portfinder');
6const getPort = denodeify(PortFinder.getPort);
7function checkPort(port, host, basePort = 49152) {
8 PortFinder.basePort = basePort;
9 return getPort({ port, host })
10 .then(foundPort => {
11 // If the port isn't available and we weren't looking for any port, throw error.
12 if (port !== foundPort && port !== 0) {
13 throw new SilentError(`Port ${port} is already in use. Use '--port' to specify a different port.`);
14 }
15 // Otherwise, our found port is good.
16 return foundPort;
17 });
18}
19exports.checkPort = checkPort;
20//# sourceMappingURL=/users/hans/sources/angular-cli/utilities/check-port.js.map
\No newline at end of file