Given I do something like:
shelljs.exec('someLongrunningCommand', {async: true})
How can I send a SIGINT or otherwise cancel this process in the same script?
Given I do something like:
shelljs.exec('someLongrunningCommand', {async: true})
How can I send a SIGINT or otherwise cancel this process in the same script?
You can cancel the process by sending a SIGINT or SIGHUP signal with subprocess.kill() methods like this:
const shell = require('shelljs');
let process = shell.exec('someLongrunningCommand', { async: true });
// Here you stop the process
process.kill('SIGINT');