-
-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
When stopAllProcesses() is called during before-quit, killSync() throws if a child process has already exited. This surfaces as an Electron "JavaScript error in the main process" dialog on Windows.
Uncaught Exception:
Error: Command failed: taskkill /pid 76672 /T /F
ERROR: The process "76672" not found.
at killSync (node_modules/kill-sync/dist/cjs/kill.js:22:42)
at stopProcess (electron-plugin/dist/server/api/childProcess.js)
at stopAllProcesses (electron-plugin/dist/server/api/childProcess.js)
The function already guards against a missing alias (if (proc === undefined) return), but doesn't handle the case where the process object exists in state while the OS process has already terminated.
This can happen when:
- The PHP process crashes or exits on its own before app quit
stopAllProcesses()is called more than once during shutdown (e.g.before-quitfires multiple times)autoUpdater.quitAndInstall()triggers a quit while a quit is already in progress
Steps to reproduce
- Start a NativePHP app on Windows
- Trigger a scenario where the PHP child process exits before
stopAllProcesses()runs duringbefore-quit - Close the app
Expected: App closes cleanly.
Actual: Error dialog: "A JavaScript error occurred in the main process"
Suggested fix
Wrap the kill calls in stopProcess with a try-catch — a dead process is the desired outcome, not an error.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels