Archived
1
0

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.
This commit is contained in:
Asher 2022-08-30 10:19:19 -05:00 committed by GitHub
parent 101d4ee4ad
commit 6262c7a0bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 3 deletions

17
patches/exec-argv.diff Normal file
View File

@ -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}`];
}

View File

@ -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);

View File

@ -21,3 +21,4 @@ telemetry.diff
display-language.diff
cli-window-open.diff
heartbeat.diff
exec-argv.diff

View File

@ -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(),