Commit 5de42d43 authored by Tristan Van Berkom's avatar Tristan Van Berkom
Browse files

Merge branch 'tristan/keyboard-interrupt-stack-trace' into 'master'

Fix stack traces discovered with ^C forceful termination.

See merge request !1043
parents 7dfb85b3 891fcb0e
Loading
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -28,8 +28,6 @@ import traceback
import asyncio
import multiprocessing

import psutil

# BuildStream toplevel imports
from ..._exceptions import ImplError, BstError, set_last_task_error, SkipJob
from ..._message import Message, MessageType, unconditional_messages
@@ -215,17 +213,10 @@ class Job():
    # Forcefully kill the process, and any children it might have.
    #
    def kill(self):

        # Force kill
        self.message(MessageType.WARN,
                     "{} did not terminate gracefully, killing".format(self.action_name))

        try:
        utils._kill_process_tree(self._process.pid)
        # This can happen if the process died of its own accord before
        # we try to kill it
        except psutil.NoSuchProcess:
            return

    # suspend()
    #
+5 −0
Original line number Diff line number Diff line
@@ -1050,6 +1050,11 @@ def _kill_process_tree(pid):
            # Ignore this error, it can happen with
            # some setuid bwrap processes.
            pass
        except psutil.NoSuchProcess:
            # It is certain that this has already been sent
            # SIGTERM, so there is a window where the process
            # could have exited already.
            pass

    # Bloody Murder
    for child in children: