@@ -11,7 +11,7 @@ import { app, session, powerMonitor } from "electron";
11
11
import { initialize } from "@electron/remote/main/index.js" ;
12
12
import state from "./server/state.js" ;
13
13
import { 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" ;
15
15
import { notifyLaravel } from "./server/utils.js" ;
16
16
import { resolve } from "path" ;
17
17
import { stopAllProcesses } from "./server/api/childProcess.js" ;
@@ -22,8 +22,8 @@ const { autoUpdater } = electronUpdater;
22
22
class NativePHP {
23
23
constructor ( ) {
24
24
this . processes = [ ] ;
25
- this . schedulerInterval = undefined ;
26
25
this . mainWindow = null ;
26
+ this . schedulerInterval = undefined ;
27
27
}
28
28
bootstrap ( app , icon , phpBinary , cert ) {
29
29
initialize ( ) ;
@@ -149,7 +149,6 @@ class NativePHP {
149
149
event : "\\Native\\Laravel\\Events\\App\\OpenedFromURL" ,
150
150
payload : {
151
151
url : commandLine [ commandLine . length - 1 ] ,
152
- workingDirectory : workingDirectory ,
153
152
} ,
154
153
} ) ;
155
154
} ) ;
@@ -193,6 +192,7 @@ class NativePHP {
193
192
clearInterval ( this . schedulerInterval ) ;
194
193
this . schedulerInterval = null ;
195
194
}
195
+ killScheduler ( ) ;
196
196
}
197
197
startScheduler ( ) {
198
198
const now = new Date ( ) ;
@@ -207,9 +207,14 @@ class NativePHP {
207
207
} , delay ) ;
208
208
}
209
209
killChildProcesses ( ) {
210
+ this . stopScheduler ( ) ;
210
211
this . processes
211
212
. filter ( ( p ) => p !== undefined )
212
213
. forEach ( ( process ) => {
214
+ if ( ! process || ! process . pid )
215
+ return ;
216
+ if ( process . killed && process . exitCode !== null )
217
+ return ;
213
218
try {
214
219
killSync ( process . pid , 'SIGTERM' , true ) ;
215
220
ps . kill ( process . pid ) ;
0 commit comments