I am trying to stop a child-process in js, the problem is that it just ignores the stop call. This is the code:
var child = null
child = child_process.spawn("webtorrent --vlc magnet:?xt=urn:btih:414A6F933C48FC7543A9CDB42C854B5457C5BCC7&dn=Avengers%3A+Endgame+%282019%29+%5BWEBRip%5D+%5B1080p%5D+%5BYTS%5D+%5BYIFY%5D&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969%2Fannounce&tr=udp%3A%2F%2F9.rarbg.com%3A2710%2Fannounce&tr=udp%3A%2F%2Fp4p.arenabg.com%3A1337&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.zer0day.to%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969%2Fannounce&tr=udp%3A%2F%2Fcoppersurfer.tk%3A6969%2Fannounce", undefined, {
encoding: 'utf8',
shell: true
});
child.stdout.on('data', (data) => {
//Here is the output
data=data.toString();
console.log(data)
});
setTimeout(function() {
console.log('Killing Your child', child.pid);
child.kill()
}, 5 * 1000);
I don't think it has to do with it, but the command I'm running runs with webtorrent, Web torrent-client is a torrent, that can download magnet links: https://www.npmjs.com/package/webtorrent-cli
the timeout runs after 5 seconds, it logs the message but never stops the process
I tried using tags inside the kill() like: "SIGINT" or "SIGKILL"
I tried running without the timeout too...