Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: kill tree php server #157

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -220,7 +221,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
Loading