Skip to content

Commit b0718db

Browse files
authored
fix: kill tree php server (#157)
1 parent 42026e6 commit b0718db

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

resources/js/electron-plugin/dist/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { notifyLaravel } from "./server/utils.js";
1616
import { resolve } from "path";
1717
import { stopAllProcesses } from "./server/api/childProcess.js";
1818
import ps from "ps-node";
19+
import killSync from "kill-sync";
1920
import electronUpdater from 'electron-updater';
2021
const { autoUpdater } = electronUpdater;
2122
class NativePHP {
@@ -173,6 +174,7 @@ class NativePHP {
173174
.filter((p) => p !== undefined)
174175
.forEach((process) => {
175176
try {
177+
killSync(process.pid, 'SIGTERM', true);
176178
ps.kill(process.pid);
177179
}
178180
catch (err) {

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { notifyLaravel } from "./server/utils.js";
1414
import { resolve } from "path";
1515
import { stopAllProcesses } from "./server/api/childProcess.js";
1616
import ps from "ps-node";
17+
import killSync from "kill-sync";
1718

1819
// Workaround for CommonJS module
1920
import electronUpdater from 'electron-updater';
@@ -241,7 +242,9 @@ class NativePHP {
241242
.filter((p) => p !== undefined)
242243
.forEach((process) => {
243244
try {
244-
ps.kill(process.pid);
245+
// @ts-ignore
246+
killSync(process.pid, 'SIGTERM', true); // Kill tree
247+
ps.kill(process.pid); // Sometimes does not kill the subprocess of php server
245248
} catch (err) {
246249
console.error(err);
247250
}

0 commit comments

Comments
 (0)