diff --git a/src/shell.js b/src/shell.js index 64658bbb4..0505de183 100644 --- a/src/shell.js +++ b/src/shell.js @@ -92,8 +92,10 @@ function spawn(tag, file, args, options) { }); signal?.addEventListener('abort', () => { + debug(`${tag}: aborting ${cp.pid}`); child_process.execFile('/usr/bin/sudo', [ KILL_CHILD_CMD, cp.pid, process.pid ], { encoding: 'utf8' }, (error, stdout, stderr) => { if (error) debug(`${tag}: failed to kill children`, stdout, stderr); + else debug(`${tag}: aborted ${cp.pid}`, stdout, stderr); }); }, { once: true }); diff --git a/src/tasks.js b/src/tasks.js index 96a41db3e..8ef320e21 100644 --- a/src/tasks.js +++ b/src/tasks.js @@ -233,8 +233,8 @@ async function stopTask(id) { } async function stopAllTasks() { - debug('stopAllTasks: ignoring exit status of starttask'); const acs = Object.values(gTasks); + debug(`stopAllTasks: ${acs.length} tasks are running. sending abort signal`); gTasks = {}; // this signals startTask() to not set completion status as "crashed" acs.forEach(ac => ac.abort()); // cleanup all the sudos and systemd-run const [error] = await safe(shell.sudo([ STOP_TASK_CMD, 'all' ], { cwd: paths.baseDir() }));