code: def _setup_sig_handler(self):
          
          def handler(signum, stack, self=self, parentpid=os.getpid()):
              if os.getpid() == parentpid:
                  self.job.taskmaster.stop()
                  self.job.interrupted.set()
              else:
                  os._exit(2)
  
          self.old_sigint  = signal.signal(signal.SIGINT, handler)
          self.old_sigterm = signal.signal(signal.SIGTERM, handler)
          try:
              self.old_sighup = signal.signal(signal.SIGHUP, handler)
          except AttributeError:
              pass
docs: Setup an interrupt handler so that SCons can shutdown cleanly in
          various conditions:
  
            a) SIGINT: Keyboard interrupt
            b) SIGTERM: kill or system shutdown
            c) SIGHUP: Controlling shell exiting
  
          We handle all of these cases by stopping the taskmaster. It
          turns out that it's very difficult to stop the build process
          by throwing asynchronously an exception such as
          KeyboardInterrupt. For example, the python Condition
          variables (threading.Condition) and queues do not seem to be
          asynchronous-exception-safe. It would require adding a whole
          bunch of try/finally block and except KeyboardInterrupt all
          over the place.
  
          Note also that we have to be careful to handle the case when
          SCons forks before executing another process. In that case, we
          want the child to exit immediately.