Skip to content

fix: propagate execArgv #5510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions patches/exec-argv.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Preserve process.execArgv

This ensures flags like --prof are passed down so we can profile everything.

Index: code-server/lib/vscode/src/vs/server/node/extensionHostConnection.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/extensionHostConnection.ts
+++ code-server/lib/vscode/src/vs/server/node/extensionHostConnection.ts
@@ -228,7 +228,7 @@ export class ExtensionHostConnection {

public async start(startParams: IRemoteExtensionHostStartParams): Promise<void> {
try {
- let execArgv: string[] = [];
+ let execArgv: string[] = process.execArgv ? process.execArgv.filter(a => !/^--inspect(-brk)?=/.test(a)) : [];
if (startParams.port && !(<any>process).pkg) {
execArgv = [`--inspect${startParams.break ? '-brk' : ''}=${startParams.port}`];
}
2 changes: 1 addition & 1 deletion patches/heartbeat.diff
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Index: code-server/lib/vscode/src/vs/base/parts/ipc/common/ipc.net.ts

export const enum SocketDiagnosticsEventType {
Created = 'created',
@@ -828,6 +829,19 @@ export class PersistentProtocol implemen
@@ -829,6 +830,19 @@ export class PersistentProtocol implemen
this._socketDisposables.push(this._socketWriter);
this._socketReader = new ProtocolReader(this._socket);
this._socketDisposables.push(this._socketReader);
Expand Down
1 change: 1 addition & 0 deletions patches/series
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ telemetry.diff
display-language.diff
cli-window-open.diff
heartbeat.diff
exec-argv.diff
3 changes: 1 addition & 2 deletions src/node/wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,7 @@ export class ParentProcess extends Process {
}

private spawn(): cp.ChildProcess {
// Use spawn (instead of fork) to use the new binary in case it was updated.
return cp.spawn(process.argv[0], process.argv.slice(1), {
return cp.fork(path.join(__dirname, "entry"), {
env: {
...process.env,
CODE_SERVER_PARENT_PID: process.pid.toString(),
Expand Down