From 1788f04f5cced1bf75ab033d8d629c398de21976 Mon Sep 17 00:00:00 2001 From: Shreya Keshive Date: Mon, 8 Sep 2025 10:53:28 -0400 Subject: [PATCH] fix(ide): fix crash on windows when null command is returned (#8007) Co-authored-by: Bryan Morgan --- packages/core/src/ide/process-utils.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/core/src/ide/process-utils.ts b/packages/core/src/ide/process-utils.ts index ecb93781cc..170b1df187 100644 --- a/packages/core/src/ide/process-utils.ts +++ b/packages/core/src/ide/process-utils.ts @@ -44,11 +44,18 @@ async function getProcessInfo(pid: number): Promise<{ ParentProcessId = 0, CommandLine = '', } = JSON.parse(output); - return { parentPid: ParentProcessId, name: Name, command: CommandLine }; + return { + parentPid: ParentProcessId, + name: Name, + command: CommandLine ?? '', + }; } else { const command = `ps -o ppid=,command= -p ${pid}`; const { stdout } = await execAsync(command); const trimmedStdout = stdout.trim(); + if (!trimmedStdout) { + return { parentPid: 0, name: '', command: '' }; + } const ppidString = trimmedStdout.split(/\s+/)[0]; const parentPid = parseInt(ppidString, 10); const fullCommand = trimmedStdout.substring(ppidString.length).trim();