Skip to content

Commit 616bdb3

Browse files
committed
Fix using port zero
1 parent 42f7b5d commit 616bdb3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cli.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const startVscode = async (): Promise<void | void[]> => {
120120

121121
const server = new MainServer({
122122
...options,
123-
port: typeof args.port !== "undefined" && parseInt(args.port, 10) || 8080,
123+
port: typeof args.port !== "undefined" ? parseInt(args.port, 10) : 8080,
124124
socket: args.socket,
125125
}, args);
126126

@@ -151,7 +151,7 @@ const startVscode = async (): Promise<void | void[]> => {
151151

152152
if (!server.options.socket && args.open) {
153153
// The web socket doesn't seem to work if browsing with 0.0.0.0.
154-
const openAddress = `http://localhost:${server.options.port}`;
154+
const openAddress = serverAddress.replace(/:\/\/0.0.0.0/, "://localhost");
155155
await open(openAddress).catch(console.error);
156156
logger.info(` - Opened ${openAddress}`);
157157
}

0 commit comments

Comments
 (0)