fix(process-utils): fix bug that prevented start-up when running process walking command fails (#7757)
This commit is contained in:
parent
9e574773c9
commit
ad3bc17e45
1 changed files with 38 additions and 34 deletions
|
|
@ -24,6 +24,7 @@ async function getProcessInfo(pid: number): Promise<{
|
|||
name: string;
|
||||
command: string;
|
||||
}> {
|
||||
try {
|
||||
const platform = os.platform();
|
||||
if (platform === 'win32') {
|
||||
const powershellCommand = [
|
||||
|
|
@ -58,6 +59,10 @@ async function getProcessInfo(pid: number): Promise<{
|
|||
command: fullCommand,
|
||||
};
|
||||
}
|
||||
} catch (_e) {
|
||||
console.debug(`Failed to get process info for pid ${pid}:`, _e);
|
||||
return { parentPid: 0, name: '', command: '' };
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -169,7 +174,6 @@ async function getIdeProcessInfoForWindows(): Promise<{
|
|||
* top-level ancestor process ID and command as a fallback.
|
||||
*
|
||||
* @returns A promise that resolves to the PID and command of the IDE process.
|
||||
* @throws Will throw an error if the underlying shell commands fail.
|
||||
*/
|
||||
export async function getIdeProcessInfo(): Promise<{
|
||||
pid: number;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue