kill function to cross-spawn processes
cross-spawn is a cross platform solution to node's
spawn. However, it
doesn't provide a mechanism for "killing" the process after it's begun (in a cross platform manner).
This solution provides a
kill function on the
child returned from
spawn which will kill the corresponding process
when invoked. It does not work with
spawn.sync as the process will be finished before your code could run anyway.
npm install --save cross-spawn-with-kill
const spawn = require('cross-spawn-with-kill') const child = spawn('webpack') child.kill() // <-- that's the ✨ magic ✨ extra function
There are none that I'm aware of. The issue on
cross-spawn requesting this feature was rejected. Hence the creation of this module.
Thanks goes to these people (emoji key):
Kent C. Dodds
This project follows the all-contributors specification. Contributions of any kind welcome!