Skip to content

Commit 74335fc

Browse files
committed
Split host from port to a different argument in vsDebugServer
1 parent 357db98 commit 74335fc

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

src/serverSessionManager.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ export class ServerSessionManager<T extends IDebugSessionLike> {
2626
private readonly portLeaseTracker: IPortLeaseTracker;
2727
private disposables: IDisposable[] = [];
2828
private servers = new Map<string, net.Server>();
29-
private host = '127.0.0.1';
3029

31-
constructor(globalContainer: Container, sessionLauncher: ISessionLauncher<T>, host?: string) {
30+
constructor(
31+
globalContainer: Container,
32+
sessionLauncher: ISessionLauncher<T>,
33+
private readonly host = '127.0.0.1',
34+
) {
3235
this.sessionManager = new SessionManager(globalContainer, sessionLauncher);
3336
this.portLeaseTracker = globalContainer.get(IPortLeaseTracker);
3437
this.disposables.push(this.sessionManager);
35-
if (host) {
36-
this.host = host;
37-
}
3838
}
3939

4040
/**

src/vsDebugServer.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,11 @@ class VsDebugServer implements ISessionLauncher<VSDebugSession> {
128128

129129
let debugServerPort: number | undefined = undefined;
130130
let debugServerHost: string | undefined = undefined;
131+
131132
if (process.argv.length >= 3) {
132-
// Interpret the argument as either a port number, or 'address:port'.
133-
const address = process.argv[2];
134-
const colonIndex = address.lastIndexOf(':');
135-
if (colonIndex === -1) {
136-
debugServerPort = +address;
137-
} else {
138-
debugServerHost = address.substring(0, colonIndex);
139-
debugServerPort = +address.substring(colonIndex + 1);
133+
debugServerPort = +process.argv[2];
134+
if (process.argv.length >= 4) {
135+
debugServerHost = process.argv[3];
140136
}
141137
}
142138

0 commit comments

Comments
 (0)