Skip to content

Commit

Permalink
Fix masking exit code
Browse files Browse the repository at this point in the history
Addresses the part of #6367 that we can fix.
  • Loading branch information
code-asher committed Apr 6, 2024
1 parent ebd79ed commit bec6ab2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/node/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,17 @@ export const runCodeCli = async (args: DefaultedArgs): Promise<void> => {

try {
await spawnCli(await toCodeArgs(args))
// Rather than have the caller handle errors and exit, spawnCli will exit
// itself. Additionally, it does this on a timeout set to 0. So, try
// waiting for VS Code to exit before giving up and doing it ourselves.
await new Promise((r) => setTimeout(r, 1000))
logger.warn("Code never exited")
process.exit(0)
} catch (error: any) {
// spawnCli catches all errors, but just in case that changes.
logger.error("Got error from Code", error)
process.exit(1)
}

process.exit(0)
}

export const openInExistingInstance = async (args: DefaultedArgs, socketPath: string): Promise<void> => {
Expand Down

0 comments on commit bec6ab2

Please sign in to comment.