From 95ef6dbf2f9eaf999406878d195e3318721c1f3c Mon Sep 17 00:00:00 2001 From: Asher Date: Wed, 18 Nov 2020 13:08:57 -0600 Subject: [PATCH] Remove unused wrapper options Also move our memory default to the beginning of NODE_OPTIONS so it can be overidden. The version of the flag with dashes seems to be the more correct one now so use that instead of underscores. Related: #2113. --- src/node/wrapper.ts | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/node/wrapper.ts b/src/node/wrapper.ts index b63d6057..f6f84e2b 100644 --- a/src/node/wrapper.ts +++ b/src/node/wrapper.ts @@ -201,11 +201,6 @@ class ChildProcess extends Process { } } -export interface WrapperOptions { - maxMemory?: number - nodeOptions?: string -} - /** * Parent process wrapper that spawns the child process and performs a handshake * with it. Will relaunch the child if it receives a SIGUSR1 or is asked to by @@ -224,7 +219,7 @@ export class ParentProcess extends Process { private args?: DefaultedArgs - public constructor(private currentVersion: string, private readonly options?: WrapperOptions) { + public constructor(private currentVersion: string) { super() process.on("SIGUSR1", async () => { @@ -310,18 +305,12 @@ export class ParentProcess extends Process { } private spawn(): cp.ChildProcess { - // Flags to pass along to the Node binary. - let nodeOptions = `${process.env.NODE_OPTIONS || ""} ${(this.options && this.options.nodeOptions) || ""}` - if (!/max_old_space_size=(\d+)/g.exec(nodeOptions)) { - nodeOptions += ` --max_old_space_size=${(this.options && this.options.maxMemory) || 2048}` - } - // 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), { env: { ...process.env, CODE_SERVER_PARENT_PID: process.pid.toString(), - NODE_OPTIONS: nodeOptions, + NODE_OPTIONS: `--max-old-space-size=2048 ${process.env.NODE_OPTIONS || ""}`, }, stdio: ["ipc"], })