@@ -11,7 +11,7 @@ import { app, session, powerMonitor } from "electron";
1111import { initialize } from "@electron/remote/main/index.js" ;
1212import state from "./server/state.js" ;
1313import { electronApp , optimizer } from "@electron-toolkit/utils" ;
14- import { retrieveNativePHPConfig , retrievePhpIniSettings , runScheduler , startAPI , startPhpApp , } from "./server/index.js" ;
14+ import { retrieveNativePHPConfig , retrievePhpIniSettings , runScheduler , killScheduler , startAPI , startPhpApp , } from "./server/index.js" ;
1515import { notifyLaravel } from "./server/utils.js" ;
1616import { resolve } from "path" ;
1717import { stopAllProcesses } from "./server/api/childProcess.js" ;
@@ -22,8 +22,8 @@ const { autoUpdater } = electronUpdater;
2222class NativePHP {
2323 constructor ( ) {
2424 this . processes = [ ] ;
25- this . schedulerInterval = undefined ;
2625 this . mainWindow = null ;
26+ this . schedulerInterval = undefined ;
2727 }
2828 bootstrap ( app , icon , phpBinary , cert ) {
2929 initialize ( ) ;
@@ -149,7 +149,6 @@ class NativePHP {
149149 event : "\\Native\\Laravel\\Events\\App\\OpenedFromURL" ,
150150 payload : {
151151 url : commandLine [ commandLine . length - 1 ] ,
152- workingDirectory : workingDirectory ,
153152 } ,
154153 } ) ;
155154 } ) ;
@@ -193,6 +192,7 @@ class NativePHP {
193192 clearInterval ( this . schedulerInterval ) ;
194193 this . schedulerInterval = null ;
195194 }
195+ killScheduler ( ) ;
196196 }
197197 startScheduler ( ) {
198198 const now = new Date ( ) ;
@@ -207,9 +207,14 @@ class NativePHP {
207207 } , delay ) ;
208208 }
209209 killChildProcesses ( ) {
210+ this . stopScheduler ( ) ;
210211 this . processes
211212 . filter ( ( p ) => p !== undefined )
212213 . forEach ( ( process ) => {
214+ if ( ! process || ! process . pid )
215+ return ;
216+ if ( process . killed && process . exitCode !== null )
217+ return ;
213218 try {
214219 killSync ( process . pid , 'SIGTERM' , true ) ;
215220 ps . kill ( process . pid ) ;
0 commit comments