diff --git a/backend/api.js b/backend/api.js index d722589..d930d25 100644 --- a/backend/api.js +++ b/backend/api.js @@ -300,7 +300,11 @@ export class Session { template, } = this.config; 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. this.term.live = false; this.term = null; diff --git a/system/res/docker-exec.py b/system/res/docker-exec.py index 48b8634..8d13799 100755 --- a/system/res/docker-exec.py +++ b/system/res/docker-exec.py @@ -30,7 +30,6 @@ args = parser.parse_args() pidfiles = "/var/run/riju/pidfiles" pidfile = pidfiles + "/" + str(uuid.uuid4()).replace("-", "") -print(pidfile) # We have to use 'kill -9' here, otherwise runuser intercepts the # signal and takes its sweet time cleaning up. @@ -44,7 +43,7 @@ def cleanup(*ignored_args): f""" set -euo pipefail if [[ -f '{pidfile}' ]]; then - kill -9 -$(< '{pidfile}') + kill -9 -$(< '{pidfile}') 2>/dev/null || true rm -f '{pidfile}' fi """