Skip to content

Commit

Permalink
FIX: node-tree-killのエラー処理のミスを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
sabonerune committed May 8, 2024
1 parent 6801519 commit 6b66b28
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/backend/electron/manager/engineManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,13 @@ export class EngineManager {
return undefined;
}

const enginePid = engineProcess.pid;
if (enginePid == undefined) {
log.error(`ENGINE ${engineId}: Pid is ${enginePid}`);
return undefined;
}
return new Promise<void>((resolve, reject) => {
log.info(
`ENGINE ${engineId}: Killing process (PID=${engineProcess.pid})`,
);
log.info(`ENGINE ${engineId}: Killing process (PID=${enginePid})`);

// エラーダイアログを抑制
engineProcessContainer.willQuitEngine = true;
Expand All @@ -434,12 +437,12 @@ export class EngineManager {
resolve();
});

try {
engineProcess.pid != undefined && treeKill(engineProcess.pid);
} catch (error: unknown) {
log.error(`ENGINE ${engineId}: Error during killing process`);
reject(error);
}
treeKill(enginePid, (error) => {
if (error != undefined) {
log.error(`ENGINE ${engineId}: Error during killing process`);
reject(error);
}
});
});
}

Expand Down

0 comments on commit 6b66b28

Please sign in to comment.