cleanup.js
This file
Path
lib/exit/cleanup.js
16 lines · 366 bytes · JavaScript
Last changed by
Rename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343
History of this fileTake it
Split files (#837)ehmickybefore adoption672c2d7
lines 1–4why, one step back1import {addAbortListener} from 'node:events';2import {onExit} from 'signal-exit';34// `cleanup` option handlingRename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343
line 5why, one step back5export const cleanupOnExit = (subprocess, {cleanup, detached}, {signal}) => {Split files (#837)ehmickybefore adoption672c2d7
lines 6–10why, one step back6 if (!cleanup || detached) {7 return;8 }910 const removeExitHandler = onExit(() => {Rename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343
line 11why, one step back11 subprocess.kill();Split files (#837)ehmickybefore adoption672c2d7
lines 12–16why, one step back12 });13 addAbortListener(signal, () => {14 removeExitHandler();15 });16};