server-main.js should respect the --port argument (#161254)

After https://github.com/microsoft/vscode/pull/160094 merged, `server-main.js` ignores the `--port` argument.
This patch fixes the problem.
This commit is contained in:
Artem Zatsarynnyi
2022-09-20 16:34:35 +02:00
committed by GitHub
parent 63c8b91c18
commit 95bf25f800

View File

@@ -188,14 +188,10 @@ function sanitizeStringArg(val) {
* @throws
*/
async function parsePort(host, strPort) {
let specificPort;
if (strPort) {
let range;
if (strPort.match(/^\d+$/)) {
specificPort = parseInt(strPort, 10);
if (specificPort === 0) {
return specificPort;
}
return parseInt(strPort, 10);
} else if (range = parseRange(strPort)) {
const port = await findFreePort(host, range.start, range.end);
if (port !== undefined) {