This commit is contained in:
Radon Rosborough 2021-06-19 08:09:22 +00:00
parent 9256f228e6
commit fcf5432058
2 changed files with 6 additions and 3 deletions

View File

@ -300,7 +300,11 @@ export class Session {
template, template,
} = this.config; } = this.config;
if (this.term) { if (this.term) {
process.kill(this.term.pty.pid); try {
process.kill(this.term.pty.pid);
} catch (err) {
// process might have already exited
}
// Signal to terminalOutput message generator using closure. // Signal to terminalOutput message generator using closure.
this.term.live = false; this.term.live = false;
this.term = null; this.term = null;

View File

@ -30,7 +30,6 @@ args = parser.parse_args()
pidfiles = "/var/run/riju/pidfiles" pidfiles = "/var/run/riju/pidfiles"
pidfile = pidfiles + "/" + str(uuid.uuid4()).replace("-", "") pidfile = pidfiles + "/" + str(uuid.uuid4()).replace("-", "")
print(pidfile)
# We have to use 'kill -9' here, otherwise runuser intercepts the # We have to use 'kill -9' here, otherwise runuser intercepts the
# signal and takes its sweet time cleaning up. # signal and takes its sweet time cleaning up.
@ -44,7 +43,7 @@ def cleanup(*ignored_args):
f""" f"""
set -euo pipefail set -euo pipefail
if [[ -f '{pidfile}' ]]; then if [[ -f '{pidfile}' ]]; then
kill -9 -$(< '{pidfile}') kill -9 -$(< '{pidfile}') 2>/dev/null || true
rm -f '{pidfile}' rm -f '{pidfile}'
fi fi
""" """