Skip to content

Commit

Permalink
Fix cli being ran twice
Browse files Browse the repository at this point in the history
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 #7042
  • Loading branch information
code-asher committed Nov 4, 2024
1 parent 952523f commit 344df38
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/node/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const runCodeCli = async (args: DefaultedArgs): Promise<void> => {
logger.debug("Running Code CLI")
try {
// See vscode.loadVSCode for more on this jank.
process.env.CODE_SERVER_PARENT_PID = process.pid.toString()
const modPath = path.join(vsRootPath, "out/server-main.js")
const mod = (await eval(`import("${modPath}")`)) as VSCodeModule
const serverModule = await mod.loadCodeWithNls()
Expand Down

0 comments on commit 344df38

Please sign in to comment.