mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +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:
@@ -4,6 +4,7 @@ import { resolve } from 'node:path';
|
||||
import type { ChildProcessWithoutNullStreams } from 'child_process';
|
||||
import type { BuildContext } from 'esbuild';
|
||||
import * as esbuild from 'esbuild';
|
||||
import kill from 'tree-kill';
|
||||
|
||||
import { config, electronDir, rootDir } from './common';
|
||||
|
||||
@@ -24,9 +25,9 @@ function spawnOrReloadElectron() {
|
||||
if (watchMode) {
|
||||
return;
|
||||
}
|
||||
if (spawnProcess !== null) {
|
||||
if (spawnProcess !== null && spawnProcess.pid) {
|
||||
spawnProcess.off('exit', process.exit);
|
||||
spawnProcess.kill('SIGINT');
|
||||
kill(spawnProcess.pid);
|
||||
spawnProcess = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user