ee-bin 4.0.0 → 4.0.1

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.
@@ -26,6 +26,7 @@ module.exports = {
26
26
  loadingPage: '/public/html/loading.html',
27
27
  watch: false,
28
28
  sync: false,
29
+ delay: 1000,
29
30
  },
30
31
  },
31
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ee-bin",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "ee bin",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -26,6 +26,7 @@
26
26
  "is-type-of": "^1.2.1",
27
27
  "javascript-obfuscator": "^4.0.2",
28
28
  "json5": "^2.2.3",
29
- "mkdirp": "^2.1.3"
29
+ "mkdirp": "^2.1.3",
30
+ "tree-kill": "^1.2.2"
30
31
  }
31
32
  }
package/tools/serve.js CHANGED
@@ -9,6 +9,7 @@ const chalk = require('chalk');
9
9
  const crossSpawn = require('cross-spawn');
10
10
  const { buildSync } = require('esbuild');
11
11
  const chokidar = require('chokidar');
12
+ const kill = require('tree-kill');
12
13
 
13
14
  class ServeProcess {
14
15
 
@@ -57,16 +58,23 @@ class ServeProcess {
57
58
  // rebuild code
58
59
  this.bundle(binCfg.build.electron);
59
60
  let subPorcess = this.execProcess[cmd];
60
- subPorcess.kill();
61
+ kill(subPorcess.pid, 'SIGKILL', (err) => {
62
+ if (err) {
63
+ console.log(chalk.red('[ee-bin] [dev] ') + `Restart failed, error: ${err}`);
64
+ process.exit(-1);
65
+ }
66
+ })
61
67
  delete this.execProcess[cmd];
62
68
 
63
69
  // restart electron command
64
- let onlyElectronOpt = {
65
- binCmd,
66
- binCmdConfig,
67
- command: cmd,
68
- }
69
- this.multiExec(onlyElectronOpt);
70
+ setTimeout(() => {
71
+ let onlyElectronOpt = {
72
+ binCmd,
73
+ binCmdConfig,
74
+ command: cmd,
75
+ }
76
+ this.multiExec(onlyElectronOpt);
77
+ }, electronConfig.delay);
70
78
  });
71
79
  }
72
80