diff options
-rw-r--r-- | buildstream/_sandboxbwrap.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/buildstream/_sandboxbwrap.py b/buildstream/_sandboxbwrap.py index ceec6108a..12f3e3b09 100644 --- a/buildstream/_sandboxbwrap.py +++ b/buildstream/_sandboxbwrap.py @@ -382,6 +382,18 @@ class SandboxBwrap(Sandbox): process.communicate() exit_code = process.poll() + if interactive: + # Make this process the foreground process again, otherwise the + # next read() on stdin will trigger SIGTTIN and stop the process. + # This is required because the sandboxed process does not have + # permission to do this on its own (running in separate PID namespace). + # + # tcsetpgrp() will trigger SIGTTOU when called from a background + # process, so ignore it temporarily. + handler = signal.signal(signal.SIGTTOU, signal.SIG_IGN) + os.tcsetpgrp(0, os.getpid()) + signal.signal(signal.SIGTTOU, handler) + return exit_code def try_remove_device(self, device_path): |