ee-core 2.7.0-beta.6 → 2.7.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cross/index.js +26 -8
- package/ee/application.js +0 -2
- package/ee/eeApp.js +2 -0
- package/electron/app/index.js +4 -0
- package/package.json +1 -1
package/cross/index.js
CHANGED
|
@@ -9,7 +9,7 @@ const UtilsPargv = require('../utils/pargv');
|
|
|
9
9
|
const Ps = require('../ps');
|
|
10
10
|
const Log = require('../log');
|
|
11
11
|
const GetPort = require('../utils/get-port');
|
|
12
|
-
const
|
|
12
|
+
const { app: electronApp } = require('electron');
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Cross-language service
|
|
@@ -17,7 +17,7 @@ const CoreElectronApp = require('../electron/app');
|
|
|
17
17
|
*/
|
|
18
18
|
const CrossLanguageService = {
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
children: {},
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* create
|
|
@@ -63,19 +63,37 @@ const CrossLanguageService = {
|
|
|
63
63
|
Log.coreLogger.info(`[ee-core] [cross/run] cmd: ${cmdPath}, args: ${cmdArgs}`);
|
|
64
64
|
|
|
65
65
|
// Launch executable program
|
|
66
|
-
|
|
66
|
+
//ignore inherit
|
|
67
|
+
const coreProcess = crossSpawn(cmdPath, cmdArgs, { stdio: 'inherit', detached: false });
|
|
67
68
|
coreProcess.on('close', (code, signal) => {
|
|
68
69
|
Log.coreLogger.info(`[ee-core] [cross/run] [pid=${coreProcess.pid}, port=${confPort}] exited with code: ${code}, signal: ${signal}`);
|
|
69
70
|
if (0 !== code) {
|
|
70
71
|
// 弹错误窗口
|
|
72
|
+
Log.coreLogger.error(`[ee-core] [cross/run] Please check [${cmdName}] service log !!!`);
|
|
71
73
|
}
|
|
72
74
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
// electron quit
|
|
76
|
+
if (conf.appExit) {
|
|
77
|
+
setTimeout(() => {
|
|
78
|
+
// 进程退出前的一些清理工作
|
|
79
|
+
electronApp.quit();
|
|
80
|
+
}, 1000)
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
this.children[cmdName] = coreProcess;
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
kill() {
|
|
87
|
+
Object.keys(this.children).forEach(key => {
|
|
88
|
+
let proc = this.children[key];
|
|
89
|
+
if (proc) {
|
|
90
|
+
proc.kill('SIGINT');
|
|
91
|
+
setTimeout(() => {
|
|
92
|
+
if (proc.killed) return;
|
|
93
|
+
proc.kill('SIGKILL');
|
|
94
|
+
}, 500)
|
|
95
|
+
}
|
|
77
96
|
});
|
|
78
|
-
// this.execProcess[cmdName] = coreProcess;
|
|
79
97
|
},
|
|
80
98
|
|
|
81
99
|
getArgs(argv, key) {
|
package/ee/application.js
CHANGED
package/ee/eeApp.js
CHANGED
package/electron/app/index.js
CHANGED
|
@@ -3,6 +3,7 @@ const EE = require('../../ee');
|
|
|
3
3
|
const Log = require('../../log');
|
|
4
4
|
const Electron = require('../index');
|
|
5
5
|
const UtilsIs = require('../../utils/is');
|
|
6
|
+
const Cross = require('../../cross');
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* CoreElectronApp (框架封装的electron app对象)
|
|
@@ -34,6 +35,9 @@ const CoreElectronApp = {
|
|
|
34
35
|
|
|
35
36
|
app.on('before-quit', () => {
|
|
36
37
|
Electron.extra.closeWindow = true;
|
|
38
|
+
|
|
39
|
+
// kill cross services
|
|
40
|
+
Cross.kill();
|
|
37
41
|
})
|
|
38
42
|
|
|
39
43
|
if (CoreApp.config.hardGpu.enable == false) {
|