make sudo commands terminate properly
sudo forks and execs the program. sudo also hangs around as the parent of the program waiting on the program and also forwarding signals. sudo does not forward signals when the originator comes from the same process group. recently, there has been a change where it will forward signals as long as sudo or the command is not the group leader (https://www.sudo.ws/repos/sudo/rev/d1bf60eac57f) for us, this means that calling kill from this node process doesn't work since it's in the same group (and ubuntu 22 doesn't have the above fix). the workaround is to invoke a kill from a different process group and this is done by starting detached another idea is: use "ps --pid cp.pid -o pid=" to get the pid of the command and then send it signal directly see also: https://dxuuu.xyz/sudo.html
This commit is contained in:
@@ -2050,7 +2050,7 @@ async function getLogs(app, options) {
|
||||
const cp = logs.tail(logPaths, { lines: options.lines, follow: options.follow });
|
||||
|
||||
const logStream = new logs.LogStream({ format: options.format || 'json', source: appId });
|
||||
logStream.close = cp.kill.bind(cp, 'SIGTERM'); // hook for caller. closing stream kills the child process
|
||||
logStream.close = cp.terminate; // closing stream kills the child process
|
||||
|
||||
cp.stdout.pipe(logStream);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user