Skip to content

Commit

Permalink
fix: kill tree php server (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
SRWieZ authored Jan 21, 2025
1 parent 42026e6 commit b0718db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions resources/js/electron-plugin/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { notifyLaravel } from "./server/utils.js";
import { resolve } from "path";
import { stopAllProcesses } from "./server/api/childProcess.js";
import ps from "ps-node";
import killSync from "kill-sync";
import electronUpdater from 'electron-updater';
const { autoUpdater } = electronUpdater;
class NativePHP {
Expand Down Expand Up @@ -173,6 +174,7 @@ class NativePHP {
.filter((p) => p !== undefined)
.forEach((process) => {
try {
killSync(process.pid, 'SIGTERM', true);
ps.kill(process.pid);
}
catch (err) {
Expand Down
5 changes: 4 additions & 1 deletion resources/js/electron-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { notifyLaravel } from "./server/utils.js";
import { resolve } from "path";
import { stopAllProcesses } from "./server/api/childProcess.js";
import ps from "ps-node";
import killSync from "kill-sync";

// Workaround for CommonJS module
import electronUpdater from 'electron-updater';
Expand Down Expand Up @@ -241,7 +242,9 @@ class NativePHP {
.filter((p) => p !== undefined)
.forEach((process) => {
try {
ps.kill(process.pid);
// @ts-ignore
killSync(process.pid, 'SIGTERM', true); // Kill tree
ps.kill(process.pid); // Sometimes does not kill the subprocess of php server
} catch (err) {
console.error(err);
}
Expand Down

0 comments on commit b0718db

Please sign in to comment.