mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
fix(electron): use tree-kill for electron dev (#5252)
electron process sometimes do not get re-spawned because of some child process not being closed. use tree-kill instead.
This commit is contained in:
@@ -63,6 +63,7 @@
|
|||||||
"rxjs": "^7.8.1",
|
"rxjs": "^7.8.1",
|
||||||
"semver": "^7.5.4",
|
"semver": "^7.5.4",
|
||||||
"tinykeys": "^2.1.0",
|
"tinykeys": "^2.1.0",
|
||||||
|
"tree-kill": "^1.2.2",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"undici": "^6.0.0",
|
"undici": "^6.0.0",
|
||||||
"uuid": "^9.0.1",
|
"uuid": "^9.0.1",
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { resolve } from 'node:path';
|
|||||||
import type { ChildProcessWithoutNullStreams } from 'child_process';
|
import type { ChildProcessWithoutNullStreams } from 'child_process';
|
||||||
import type { BuildContext } from 'esbuild';
|
import type { BuildContext } from 'esbuild';
|
||||||
import * as esbuild from 'esbuild';
|
import * as esbuild from 'esbuild';
|
||||||
|
import kill from 'tree-kill';
|
||||||
|
|
||||||
import { config, electronDir, rootDir } from './common';
|
import { config, electronDir, rootDir } from './common';
|
||||||
|
|
||||||
@@ -24,9 +25,9 @@ function spawnOrReloadElectron() {
|
|||||||
if (watchMode) {
|
if (watchMode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (spawnProcess !== null) {
|
if (spawnProcess !== null && spawnProcess.pid) {
|
||||||
spawnProcess.off('exit', process.exit);
|
spawnProcess.off('exit', process.exit);
|
||||||
spawnProcess.kill('SIGINT');
|
kill(spawnProcess.pid);
|
||||||
spawnProcess = null;
|
spawnProcess = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -499,6 +499,7 @@ __metadata:
|
|||||||
rxjs: "npm:^7.8.1"
|
rxjs: "npm:^7.8.1"
|
||||||
semver: "npm:^7.5.4"
|
semver: "npm:^7.5.4"
|
||||||
tinykeys: "npm:^2.1.0"
|
tinykeys: "npm:^2.1.0"
|
||||||
|
tree-kill: "npm:^1.2.2"
|
||||||
ts-node: "npm:^10.9.1"
|
ts-node: "npm:^10.9.1"
|
||||||
undici: "npm:^6.0.0"
|
undici: "npm:^6.0.0"
|
||||||
uuid: "npm:^9.0.1"
|
uuid: "npm:^9.0.1"
|
||||||
|
|||||||
Reference in New Issue
Block a user