Skip to content

Commit 6262c7a

Browse files
authored
fix: propagate execArgv (#5510)
* Use fork instead of spawn We no longer do in-place updating so no need for the spawn. The advantage of a fork is that it preserves flags like --prof which you can use to profile code-server. Also I am not sure the comment about not being able to reload in place with fork was even true to begin with. * Refresh heartbeat patch Seems to have gotten out of date a little. * Propagate execArgv to extension host This will let us profile the extension host.
1 parent 101d4ee commit 6262c7a

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

patches/exec-argv.diff

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Preserve process.execArgv
2+
3+
This ensures flags like --prof are passed down so we can profile everything.
4+
5+
Index: code-server/lib/vscode/src/vs/server/node/extensionHostConnection.ts
6+
===================================================================
7+
--- code-server.orig/lib/vscode/src/vs/server/node/extensionHostConnection.ts
8+
+++ code-server/lib/vscode/src/vs/server/node/extensionHostConnection.ts
9+
@@ -228,7 +228,7 @@ export class ExtensionHostConnection {
10+
11+
public async start(startParams: IRemoteExtensionHostStartParams): Promise<void> {
12+
try {
13+
- let execArgv: string[] = [];
14+
+ let execArgv: string[] = process.execArgv ? process.execArgv.filter(a => !/^--inspect(-brk)?=/.test(a)) : [];
15+
if (startParams.port && !(<any>process).pkg) {
16+
execArgv = [`--inspect${startParams.break ? '-brk' : ''}=${startParams.port}`];
17+
}

patches/heartbeat.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Index: code-server/lib/vscode/src/vs/base/parts/ipc/common/ipc.net.ts
1515

1616
export const enum SocketDiagnosticsEventType {
1717
Created = 'created',
18-
@@ -828,6 +829,19 @@ export class PersistentProtocol implemen
18+
@@ -829,6 +830,19 @@ export class PersistentProtocol implemen
1919
this._socketDisposables.push(this._socketWriter);
2020
this._socketReader = new ProtocolReader(this._socket);
2121
this._socketDisposables.push(this._socketReader);

patches/series

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ telemetry.diff
2121
display-language.diff
2222
cli-window-open.diff
2323
heartbeat.diff
24+
exec-argv.diff

src/node/wrapper.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,7 @@ export class ParentProcess extends Process {
317317
}
318318

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

0 commit comments

Comments
 (0)