Tristan Van Berkom pushed to branch master at BuildStream / buildstream
Commits:
- 
891fcb0e
by Tristan Van Berkom at 2019-01-07T16:47:01Z
 - 
5de42d43
by Tristan Van Berkom at 2019-01-07T18:00:37Z
 
2 changed files:
Changes:
| ... | ... | @@ -28,8 +28,6 @@ import traceback | 
| 28 | 28 | 
 import asyncio
 | 
| 29 | 29 | 
 import multiprocessing
 | 
| 30 | 30 | 
 | 
| 31 | 
-import psutil
 | 
|
| 32 | 
-  | 
|
| 33 | 31 | 
 # BuildStream toplevel imports
 | 
| 34 | 32 | 
 from ..._exceptions import ImplError, BstError, set_last_task_error, SkipJob
 | 
| 35 | 33 | 
 from ..._message import Message, MessageType, unconditional_messages
 | 
| ... | ... | @@ -215,17 +213,10 @@ class Job(): | 
| 215 | 213 | 
     # Forcefully kill the process, and any children it might have.
 | 
| 216 | 214 | 
     #
 | 
| 217 | 215 | 
     def kill(self):
 | 
| 218 | 
-  | 
|
| 219 | 216 | 
         # Force kill
 | 
| 220 | 217 | 
         self.message(MessageType.WARN,
 | 
| 221 | 218 | 
                      "{} did not terminate gracefully, killing".format(self.action_name))
 | 
| 222 | 
-  | 
|
| 223 | 
-        try:
 | 
|
| 224 | 
-            utils._kill_process_tree(self._process.pid)
 | 
|
| 225 | 
-        # This can happen if the process died of its own accord before
 | 
|
| 226 | 
-        # we try to kill it
 | 
|
| 227 | 
-        except psutil.NoSuchProcess:
 | 
|
| 228 | 
-            return
 | 
|
| 219 | 
+        utils._kill_process_tree(self._process.pid)
 | 
|
| 229 | 220 | 
 | 
| 230 | 221 | 
     # suspend()
 | 
| 231 | 222 | 
     #
 | 
| ... | ... | @@ -1050,6 +1050,11 @@ def _kill_process_tree(pid): | 
| 1050 | 1050 | 
             # Ignore this error, it can happen with
 | 
| 1051 | 1051 | 
             # some setuid bwrap processes.
 | 
| 1052 | 1052 | 
             pass
 | 
| 1053 | 
+        except psutil.NoSuchProcess:
 | 
|
| 1054 | 
+            # It is certain that this has already been sent
 | 
|
| 1055 | 
+            # SIGTERM, so there is a window where the process
 | 
|
| 1056 | 
+            # could have exited already.
 | 
|
| 1057 | 
+            pass
 | 
|
| 1053 | 1058 | 
 | 
| 1054 | 1059 | 
     # Bloody Murder
 | 
| 1055 | 1060 | 
     for child in children:
 | 
