Terminates the child process on close.
505491
def closeEvent(self, event):
        
        self.stop_process()
        self.backend.stop()
        try:
            self.modes.remove('_LinkHighlighter')
        except KeyError:
            pass  # already removed
        super(OutputWindow, self).closeEvent(event)
937973
void monitorChild() {
    Process proc = childProc;
    if (proc == null) {
      // Process may have already been disposed of, e.g. by calling kill().
      return;
    }

    while (proc.isAlive()) {
      try {
        proc.waitFor();
      } catch (Exception e) {
        LOG.log(Level.WARNING, "Exception waiting for child process to exit.", e);
      }
    }

    synchronized (this) {
      if (isDisposed()) {
        return;
      }

      int ec;
      try {
        ec = proc.exitValue();
      } catch (Exception e) {
        LOG.log(Level.WARNING, "Exception getting child process exit code, assuming failure.", e);
        ec = 1;
      }

      if (ec != 0) {
        State currState = getState();
        // Override state with failure if the current state is not final, or is success.
        if (!currState.isFinal() || currState == State.FINISHED) {
          setState(State.FAILED, true);
        }
      }

      dispose();
    }
  }
835582
public function killChild()
    {
        if (is_null($this->child)) {
            return;
        }

        if ($this->child === 0) {
            throw new Exception\Shutdown('Job forced shutdown');
        }

        Event::fire(Event::WORKER_KILLCHILD, array($this, $this->child));

        if (posix_kill($this->child, 0)) {
            $this->log('Killing child process at pid:'.$this->child, Logger::DEBUG);

            posix_kill($this->child, SIGTERM);
        }

        $this->child = null;
    }
685418
public function close()
    {
        $this->free();
        $this->started = false;
        foreach ($this->pipes as $pipe) {
            fclose($pipe);
        }

        $this->closeProcess();
    }
448840
def close(self):
        """"""
        if self._subprocess is not None:
            os.killpg(self._subprocess.pid, signal.SIGTERM)
            self._subprocess = None
634542
def kill_process(self):
        """"""
        if self.process.poll() is not None:
            return
        try:
            if hasattr(self.process, 'terminate'):
                self.process.terminate()
            elif os.name != 'nt':
                os.kill(self.process.pid, 9)
            else:
                import ctypes
                handle = int(self.process._handle)
                ctypes.windll.kernel32.TerminateProcess(handle, -1)
        except OSError:
            pass
594614
public void terminate() {
    if (!isTerminated()) {
      for (final Stage stage : stages.values()) {
        stage.stop();
      }

      loggerProviderKeeper.close();
      mailboxProviderKeeper.close();
      completesProviderKeeper.close();
    }
  }
867647
def Close(self, abort=False):
    
    if abort:
      # Prevent join_thread() from blocking.
      self._queue.cancel_join_thread()

    self._queue.close()
    self._queue.join_thread()
117143
private void terminate()
    {
        if (this.container != null) {
            final Cache<String, Integer> cache = this.container
                            .<String, Integer>getCache(InfinispanCache.COUNTERCACHE);
            Integer count = cache.get(InfinispanCache.COUNTERCACHE);
            if (count == null || count < 2) {
                this.container.stop();
            } else {
                count = count - 1;
                cache.put(InfinispanCache.COUNTERCACHE, count);
            }
        }
    }
783800
def terminate(self):
        
        self.queue.put(dill.dumps(ExitCommand()))

        if self.process:
            self.process.join()
535201
def close (self):
        
        if self.child_fd == -1:
            return

        self.flush()
        os.close(self.child_fd)
        self.child_fd = -1
        self.closed = True
28284
def close(self):
        
        if self.parent:
            self.parent.update(self.parent.offset + self.offset)
            return
        self.output.write("\n")
        self.output.flush()
478795
def close(self):
        """"""
        if self._proc is not None:
            self._proc.stdin.close()
            self._proc.wait()
883991
def close(self, end_time=None):
        
        super(Subsegment, self).close(end_time)
        self.parent_segment.decrement_ref_counter()
140553
def _AbortTerminate(self):
    """"""
    for pid, process in iter(self._processes_per_pid.items()):
      if not process.is_alive():
        continue

      logger.warning('Terminating process: {0:s} (PID: {1:d}).'.format(
          process.name, pid))
      process.terminate()
18578
def stop(self):
        """"""
        if hasattr(self, 'process'):
            if self.process is not None:
                try:
                    is_running = self.process.poll() is None
                except AttributeError:
                    is_running = False

                if is_running:
                    self.bundle_engine.logline("Stopping {0}".format(self.service.name))
                    self.term_signal_sent = True

                    # Politely ask all child processes to die first
                    try:
                        for childproc in psutil.Process(self.process.pid).children(recursive=True):
                            childproc.send_signal(signal.SIGINT)
                    except psutil.NoSuchProcess:
                        pass
                    except AttributeError:
                        pass

                    try:
                        self.process.send_signal(self.service.stop_signal)
                    except OSError as e:
                        if e.errno == 3:        # No such process
                            pass
                else:
                    self.bundle_engine.warnline("{0} stopped prematurely.".format(self.service.name))
            else:
                self.bundle_engine.warnline("{0} stopped prematurely.".format(self.service.name))
        else:
            self.bundle_engine.warnline("{0} was never successfully started.".format(self.service.name))
1239948
def close(self):
        
        if (self.closed):
            return
        print(self.pre, "close")
        for child in self.children:
            child.close()
        self.openglthread = None
        self.gpu_handler = None
        self.closed = True
        self.window.unSetPropagate() # we don't want the window to send the close signal .. which would call this *again* (through close_slot)
        self.window.close()