diff options
author | Christopher Larson <chris_larson@mentor.com> | 2012-05-09 18:32:20 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-05-11 11:54:26 +0100 |
commit | e2c58b40d1f6b2d068d24a47b1dcfd16753d2c32 (patch) | |
tree | 76abbf4cd5ac960554f5d43b7a4eae65af60a24d /bitbake/lib/bb/runqueue.py | |
parent | 6841abd17268a1c1ca5e3634f0ae9e21426ca9c9 (diff) | |
download | poky-e2c58b40d1f6b2d068d24a47b1dcfd16753d2c32.tar.gz |
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>
Diffstat (limited to 'bitbake/lib/bb/runqueue.py')
-rw-r--r-- | bitbake/lib/bb/runqueue.py | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index b870caff4e..8828e4af6b 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py | |||
@@ -1046,18 +1046,29 @@ class RunQueueExecute: | |||
1046 | Return none is there are no processes awaiting result collection, otherwise | 1046 | Return none is there are no processes awaiting result collection, otherwise |
1047 | collect the process exit codes and close the information pipe. | 1047 | collect the process exit codes and close the information pipe. |
1048 | """ | 1048 | """ |
1049 | result = os.waitpid(-1, os.WNOHANG) | 1049 | pid, status = os.waitpid(-1, os.WNOHANG) |
1050 | if result[0] == 0 and result[1] == 0: | 1050 | if pid == 0 or os.WIFSTOPPED(status): |
1051 | return None | 1051 | return None |
1052 | task = self.build_pids[result[0]] | 1052 | |
1053 | del self.build_pids[result[0]] | 1053 | if os.WIFEXITED(status): |
1054 | self.build_pipes[result[0]].close() | 1054 | status = os.WEXITSTATUS(status) |
1055 | del self.build_pipes[result[0]] | 1055 | elif os.WIFSIGNALED(status): |
1056 | # self.build_stamps[result[0]] may not exist when use shared work directory. | 1056 | # Per shell conventions for $?, when a process exits due to |
1057 | if result[0] in self.build_stamps.keys(): | 1057 | # a signal, we return an exit code of 128 + SIGNUM |
1058 | del self.build_stamps[result[0]] | 1058 | status = 128 + os.WTERMSIG(status) |
1059 | if result[1] != 0: | 1059 | |
1060 | self.task_fail(task, result[1]>>8) | 1060 | task = self.build_pids[pid] |
1061 | del self.build_pids[pid] | ||
1062 | |||
1063 | self.build_pipes[pid].close() | ||
1064 | del self.build_pipes[pid] | ||
1065 | |||
1066 | # self.build_stamps[pid] may not exist when use shared work directory. | ||
1067 | if pid in self.build_stamps.keys(): | ||
1068 | del self.build_stamps[pid] | ||
1069 | |||
1070 | if status != 0: | ||
1071 | self.task_fail(task, status) | ||
1061 | else: | 1072 | else: |
1062 | self.task_complete(task) | 1073 | self.task_complete(task) |
1063 | return True | 1074 | return True |