1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-01 00:59:48 +00:00

runqueue: handle task exit due to signal/stop

- for a normal exit, use WEXITSTATUS, rather than manually shifting
- for exit via signal, set the exit code to 128+N, per shell convention
- if a process was stopped, return and don't handle it, as the process can yet
  be continued

This should fix the case where bitbake says a task failed with an exit code of
0 (we assumed failure based on the overall status, but didn't pass all the
information along to task_fail).

(Bitbake rev: 84ea614bc56d35a414eb5bf5658891b340bfc569)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Christopher Larson
2012-05-09 18:32:20 -05:00
committed by Richard Purdie
parent 6841abd172
commit e2c58b40d1
+22 -11
View File
@@ -1046,18 +1046,29 @@ class RunQueueExecute:
Return none is there are no processes awaiting result collection, otherwise Return none is there are no processes awaiting result collection, otherwise
collect the process exit codes and close the information pipe. collect the process exit codes and close the information pipe.
""" """
result = os.waitpid(-1, os.WNOHANG) pid, status = os.waitpid(-1, os.WNOHANG)
if result[0] == 0 and result[1] == 0: if pid == 0 or os.WIFSTOPPED(status):
return None return None
task = self.build_pids[result[0]]
del self.build_pids[result[0]] if os.WIFEXITED(status):
self.build_pipes[result[0]].close() status = os.WEXITSTATUS(status)
del self.build_pipes[result[0]] elif os.WIFSIGNALED(status):
# self.build_stamps[result[0]] may not exist when use shared work directory. # Per shell conventions for $?, when a process exits due to
if result[0] in self.build_stamps.keys(): # a signal, we return an exit code of 128 + SIGNUM
del self.build_stamps[result[0]] status = 128 + os.WTERMSIG(status)
if result[1] != 0:
self.task_fail(task, result[1]>>8) task = self.build_pids[pid]
del self.build_pids[pid]
self.build_pipes[pid].close()
del self.build_pipes[pid]
# self.build_stamps[pid] may not exist when use shared work directory.
if pid in self.build_stamps.keys():
del self.build_stamps[pid]
if status != 0:
self.task_fail(task, status)
else: else:
self.task_complete(task) self.task_complete(task)
return True return True