Skip to content

Commit d83caac

Browse files
committed
make sure process exists before killing it
1 parent 79d26e4 commit d83caac

File tree

1 file changed

+3
-0
lines changed
  • resources/js/electron-plugin/src

1 file changed

+3
-0
lines changed

resources/js/electron-plugin/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,10 @@ class NativePHP {
277277
this.processes
278278
.filter((p) => p !== undefined)
279279
.forEach((process) => {
280+
if (!process || !process.pid) return;
281+
280282
try {
283+
process.kill(0); // Test if process exists (throws error if not)
281284
// @ts-ignore
282285
killSync(process.pid, 'SIGTERM', true); // Kill tree
283286
ps.kill(process.pid); // Sometimes does not kill the subprocess of php server

0 commit comments

Comments
 (0)