From f20a0a06a95bb8db4ac86924e2d6228eaf61c0e9 Mon Sep 17 00:00:00 2001 From: Jesse Chan Date: Sun, 29 Nov 2020 00:29:21 +0800 Subject: [PATCH] config.cli: exit when managed rTorrent daemon exits --- config.cli.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/config.cli.js b/config.cli.js index f16b25fc..e2d6733c 100644 --- a/config.cli.js +++ b/config.cli.js @@ -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');