mirror of
https://github.com/alex8088/electron-vite.git
synced 2025-08-15 08:29:46 +08:00
fix: pass signals to electron process
This commit is contained in:
parent
1eeb15ea77
commit
96a25bb346
@ -161,5 +161,13 @@ export function startElectron(root: string | undefined): ChildProcess {
|
||||
const ps = spawn(electronPath, [entry].concat(args), { stdio: 'inherit' })
|
||||
ps.on('close', process.exit)
|
||||
|
||||
for (const signal of ['SIGINT', 'SIGTERM', 'SIGUSR2'] as NodeJS.Signals[]) {
|
||||
process.on(signal, () => {
|
||||
if (!ps.killed) {
|
||||
ps.kill(signal)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return ps
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user