Skip to content

Commit

Permalink
Exclude node inspect from auto port forwarding
Browse files Browse the repository at this point in the history
Fixes #107243
  • Loading branch information
alexr00 committed Sep 25, 2020
1 parent 73084f5 commit b67b5e8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/vs/workbench/contrib/remote/browser/remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,8 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
}

class AutomaticPortForwarding extends Disposable implements IWorkbenchContribution {
private contextServiceListener: IDisposable;

constructor(
@ITerminalService private readonly terminalService: ITerminalService,
@INotificationService private readonly notificationService: INotificationService,
Expand All @@ -854,12 +856,20 @@ class AutomaticPortForwarding extends Disposable implements IWorkbenchContributi
if (this.environmentService.configuration.remoteAuthority) {
this.startUrlFinder();
}
this.contextServiceListener = this._register(this.contextKeyService.onDidChangeContext(e => {
if (e.affectsSome(new Set(forwardedPortsViewEnabled.keys()))) {
this.startUrlFinder();
}
}));
}

private isStarted = false;
private startUrlFinder() {
if (!forwardedPortsViewEnabled.getValue(this.contextKeyService)) {
if (!this.isStarted && !forwardedPortsViewEnabled.getValue(this.contextKeyService)) {
return;
}
this.contextServiceListener.dispose();
this.isStarted = true;
const urlFinder = this._register(new UrlFinder(this.terminalService));
this._register(urlFinder.onDidMatchLocalUrl(async (localUrl) => {
const forwarded = await this.remoteExplorerService.forward(localUrl);
Expand Down
4 changes: 4 additions & 0 deletions src/vs/workbench/contrib/remote/browser/urlFinder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ export class UrlFinder extends Disposable {
if (host !== '0.0.0.0' && host !== '127.0.0.1') {
host = 'localhost';
}
// Exclude node inspect, except when using defualt port
if (port !== 9229 && data.startsWith('Debugger listening on')) {
return;
}
this._onDidMatchLocalUrl.fire({ port, host });
}
}
Expand Down

0 comments on commit b67b5e8

Please sign in to comment.