mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-16 03:40:37 +08:00
Replace exit-hook with custom event listeners
Instead of relying on the `exit-hook` dependency, we should listen to `exit`, `SIGINT`, `SIGTERM` and other exceptions, and kill all running processes.
This commit is contained in:
Generated
-13
@@ -48,7 +48,6 @@
|
||||
"eslint-plugin-no-only-tests": "^3.1.0",
|
||||
"eslint-plugin-svelte": "^2.35.0",
|
||||
"execa": "^8.0.1",
|
||||
"exit-hook": "^4.0.0",
|
||||
"get-port": "^7.0.0",
|
||||
"happy-dom": "^12.10.3",
|
||||
"prettier": "^3.1.0",
|
||||
@@ -2326,18 +2325,6 @@
|
||||
"url": "https://github.com/sindresorhus/execa?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/exit-hook": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-4.0.0.tgz",
|
||||
"integrity": "sha512-Fqs7ChZm72y40wKjOFXBKg7nJZvQJmewP5/7LtePDdnah/+FH9Hp5sgMujSCMPXlxOAW2//1jrW9pnsY7o20vQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/extend-shallow": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
"eslint-plugin-no-only-tests": "^3.1.0",
|
||||
"eslint-plugin-svelte": "^2.35.0",
|
||||
"execa": "^8.0.1",
|
||||
"exit-hook": "^4.0.0",
|
||||
"get-port": "^7.0.0",
|
||||
"happy-dom": "^12.10.3",
|
||||
"prettier": "^3.1.0",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { ExecaChildProcess, Options } from "execa";
|
||||
|
||||
import * as Stream from "node:stream";
|
||||
import onExit from "exit-hook";
|
||||
import { StringDecoder } from "string_decoder";
|
||||
import { execa } from "execa";
|
||||
|
||||
@@ -11,7 +10,9 @@ import { logPrefix } from "./logPrefix.js";
|
||||
// We add all proxy and node instances that we spawn to this list.
|
||||
const processes: ExecaChildProcess[] = [];
|
||||
|
||||
onExit(killAllProcesses);
|
||||
process.on("exit", killAllProcesses);
|
||||
process.on("SIGINT", killAllProcesses);
|
||||
process.on("SIGTERM", killAllProcesses);
|
||||
|
||||
// Kill all processes with SIGKILL
|
||||
export function killAllProcesses(): void {
|
||||
@@ -20,6 +21,7 @@ export function killAllProcesses(): void {
|
||||
process.kill("SIGKILL");
|
||||
}
|
||||
}
|
||||
process.exit();
|
||||
}
|
||||
|
||||
// Spawn a process with `execa` and register it.
|
||||
|
||||
Reference in New Issue
Block a user