config.cli: exit when managed rTorrent daemon exits

This commit is contained in:
Jesse Chan
2020-11-29 00:29:21 +08:00
parent 5e39927161
commit f20a0a06a9
+7
View File
@@ -161,6 +161,13 @@ if (argv.rtorrent) {
const rTorrentProcess = spawn('rtorrent', args.concat(['-o', opts]));
rTorrentProcess.on('close', () => {
process.exit();
});
rTorrentProcess.on('error', () => {
process.exit();
});
process.on('exit', () => {
console.log('Killing rTorrent daemon...');
rTorrentProcess.kill('SIGTERM');