@@ -273,6 +273,15 @@ Index: code-server/lib/vscode/src/server-main.ts
273273 // Do a quick parse to determine if a server or the cli needs to be started
274274 const parsedArgs = minimist(process.argv.slice(2), {
275275 boolean: ['start-server', 'list-extensions', 'print-ip-address', 'help', 'version', 'accept-server-license-terms', 'update-extensions'],
276+ @@ -50,7 +53,7 @@ if (shouldSpawnCli) {
277+ mod.spawnCli();
278+ });
279+ } else {
280+ - installServerProcessExitDiagnostics();
281+ + installServerProcessExitDiagnostics(parsedArgs);
282+
283+ let _remoteExtensionHostAgentServer: IServerAPI | null = null;
284+ let _remoteExtensionHostAgentServerPromise: Promise<IServerAPI> | null = null;
276285@@ -153,6 +156,7 @@ if (shouldSpawnCli) {
277286 }
278287 });
@@ -281,6 +290,15 @@ Index: code-server/lib/vscode/src/server-main.ts
281290
282291 function sanitizeStringArg(val: unknown): string | undefined {
283292 if (Array.isArray(val)) { // if an argument is passed multiple times, minimist creates an array
293+ @@ -173,7 +177,7 @@ function sanitizeStringArg(val: unknown)
294+ * provided) so they survive process teardown (an async stdio write from an
295+ * `exit` handler does not).
296+ */
297+ - function installServerProcessExitDiagnostics(): void {
298+ + function installServerProcessExitDiagnostics(parsedArgs: minimist.ParsedArgs): void {
299+ if (!process.env['VSCODE_SERVER_EXIT_DIAGNOSTICS']) {
300+ return;
301+ }
284302@@ -406,3 +410,22 @@ function prompt(question: string): Promi
285303 });
286304 });
0 commit comments