Skip to content

Commit 344df38

Browse files
committed
Fix cli being ran twice
server-main.js runs itself outside a code-server context, which is determined using the CODE_SERVER_PARENT_PID environment variable. This is set by the wrapper, but there is no wrapper when running the cli (only for the server), so this resulting in the cli running twice (one self-run on initial import, again when we run spawnCli). This might fix coder#7042
1 parent 952523f commit 344df38

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/node/main.ts

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export const runCodeCli = async (args: DefaultedArgs): Promise<void> => {
5050
logger.debug("Running Code CLI")
5151
try {
5252
// See vscode.loadVSCode for more on this jank.
53+
process.env.CODE_SERVER_PARENT_PID = process.pid.toString()
5354
const modPath = path.join(vsRootPath, "out/server-main.js")
5455
const mod = (await eval(`import("${modPath}")`)) as VSCodeModule
5556
const serverModule = await mod.loadCodeWithNls()

0 commit comments

Comments
 (0)