tinylibs / tinyexec

📟 A tiny, higher level interface around child_process
MIT License
100 stars 1 forks source link

cleanup non-persistent processes on exit #11

Open 43081j opened 2 months ago

43081j commented 2 months ago

if a process is executed with persist: false (default), we should probably forcefully kill it on exit of the parent process.

this won't be as simple as process.on('exit', onExit) since some things won't fire an exit event (but may fire signal events).

we probably just need to listen on exit and some common signals like SIGTERM.

jbolda commented 2 months ago

We have some prior work that may be of value here. These two functions cover posix and even Windows with an attempted graceful shutdown through ctrlc-windows.