File tree Expand file tree Collapse file tree 2 files changed +23
-8
lines changed
resources/js/electron-plugin/src Expand file tree Collapse file tree 2 files changed +23
-8
lines changed Original file line number Diff line number Diff line change 7
7
retrieveNativePHPConfig ,
8
8
retrievePhpIniSettings ,
9
9
runScheduler ,
10
+ killScheduler ,
10
11
startAPI ,
11
12
startPhpApp ,
12
13
} from "./server/index.js" ;
@@ -22,8 +23,8 @@ const { autoUpdater } = electronUpdater;
22
23
23
24
class NativePHP {
24
25
processes = [ ] ;
25
- schedulerInterval = undefined ;
26
26
mainWindow = null ;
27
+ schedulerInterval = undefined ;
27
28
28
29
public bootstrap (
29
30
app : CrossProcessExports . App ,
@@ -244,12 +245,13 @@ class NativePHP {
244
245
}
245
246
246
247
247
- private stopScheduler ( ) {
248
- if ( this . schedulerInterval ) {
249
- clearInterval ( this . schedulerInterval ) ;
250
- this . schedulerInterval = null ;
251
- }
252
- }
248
+ private stopScheduler ( ) {
249
+ if ( this . schedulerInterval ) {
250
+ clearInterval ( this . schedulerInterval ) ;
251
+ this . schedulerInterval = null ;
252
+ }
253
+ killScheduler ( ) ;
254
+ }
253
255
254
256
private startScheduler ( ) {
255
257
const now = new Date ( ) ;
@@ -270,6 +272,8 @@ class NativePHP {
270
272
}
271
273
272
274
private killChildProcesses ( ) {
275
+ this . stopScheduler ( ) ;
276
+
273
277
this . processes
274
278
. filter ( ( p ) => p !== undefined )
275
279
. forEach ( ( process ) => {
Original file line number Diff line number Diff line change 7
7
} from "./php.js" ;
8
8
import { appendCookie } from "./utils.js" ;
9
9
import state from "./state.js" ;
10
+ import { ChildProcess } from "child_process" ;
11
+
12
+ let schedulerProcess : ChildProcess | null = null ;
10
13
11
14
export async function startPhpApp ( ) {
12
15
const result = await serveApp (
@@ -23,7 +26,15 @@ export async function startPhpApp() {
23
26
}
24
27
25
28
export function runScheduler ( ) {
26
- startScheduler ( state . randomSecret , state . electronApiPort , state . phpIni ) ;
29
+ killScheduler ( ) ;
30
+ schedulerProcess = startScheduler ( state . randomSecret , state . electronApiPort , state . phpIni ) ;
31
+ }
32
+
33
+ export function killScheduler ( ) {
34
+ if ( schedulerProcess && ! schedulerProcess . killed ) {
35
+ schedulerProcess . kill ( ) ;
36
+ schedulerProcess = null ;
37
+ }
27
38
}
28
39
29
40
export function startAPI ( ) : Promise < APIProcess > {
You can’t perform that action at this time.
0 commit comments