diff options
author | Jürg Billeter <j@bitron.ch> | 2017-07-27 09:48:12 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2017-07-27 09:48:12 +0100 |
commit | 7bd590319df360d0aac84eff72f9dabd8b389533 (patch) | |
tree | 9516a0396ba2a9cc27e7b8e01d4761053c72ebc3 | |
parent | 9b54d40ec8267fef8c3e1a75729c0bf6ba34579d (diff) | |
download | buildstream-7bd590319df360d0aac84eff72f9dabd8b389533.tar.gz |
_scheduler/job.py: Ignore SIGTSTP error for already exited process
-rw-r--r-- | buildstream/_scheduler/job.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/buildstream/_scheduler/job.py b/buildstream/_scheduler/job.py index 910140ec4..c97258c65 100644 --- a/buildstream/_scheduler/job.py +++ b/buildstream/_scheduler/job.py @@ -172,16 +172,20 @@ class Job(): self.message(self.element, MessageType.STATUS, "{} suspending".format(self.action_name)) - # Use SIGTSTP so that child processes may handle and propagate - # it to processes they spawn that become session leaders - os.kill(self.process.pid, signal.SIGTSTP) - - # For some reason we receive exactly one suspend event for every - # SIGTSTP we send to the child fork(), even though the child forks - # are setsid(). We keep a count of these so we can ignore them - # in our event loop suspend_event() - self.scheduler.internal_stops += 1 - self.suspended = True + try: + # Use SIGTSTP so that child processes may handle and propagate + # it to processes they spawn that become session leaders + os.kill(self.process.pid, signal.SIGTSTP) + + # For some reason we receive exactly one suspend event for every + # SIGTSTP we send to the child fork(), even though the child forks + # are setsid(). We keep a count of these so we can ignore them + # in our event loop suspend_event() + self.scheduler.internal_stops += 1 + self.suspended = True + except ProcessLookupError: + # ignore, process has already exited + pass # resume() # |