From 84edf35e3d5fbaea33adc40ee528ea619f37c73e Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 4 Dec 2017 10:34:28 +0100 Subject: [PATCH] set VSCODE_PID only from first instance --- src/vs/code/electron-main/main.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vs/code/electron-main/main.ts b/src/vs/code/electron-main/main.ts index f6dcf52851e..5cca1533ddd 100644 --- a/src/vs/code/electron-main/main.ts +++ b/src/vs/code/electron-main/main.ts @@ -107,6 +107,10 @@ function setupIPC(accessor: ServicesAccessor): TPromise { console.log('Warning: The --status argument can only be used if Code is already running. Please run it again after Code has started.'); } + // Set the VSCODE_PID variable here when we are sure we are the first + // instance to startup. Otherwise we would wrongly overwrite the PID + process.env['VSCODE_PID'] = String(process.pid); + return server; }, err => { if (err.code !== 'EADDRINUSE') { @@ -253,7 +257,6 @@ function main() { // Patch `process.env` with the instance's environment const environmentService = accessor.get(IEnvironmentService); const instanceEnv: typeof process.env = { - VSCODE_PID: String(process.pid), VSCODE_IPC_HOOK: environmentService.mainIPCHandle, VSCODE_NLS_CONFIG: process.env['VSCODE_NLS_CONFIG'] }; -- GitLab