Terminates the execution of the process.

        @raise WindowsError: On error an exception is raised.
356554
def kill(self, dwExitCode = 0):
        
        hProcess = self.get_handle(win32.PROCESS_TERMINATE)
        win32.TerminateProcess(hProcess, dwExitCode)
591288
def exit_with_error(self, error, **kwargs):
        
        self.error(error, **kwargs)
        raise SystemExit(error)
544921
def stop(&block)
      block.call('stop') unless block.nil?
      pid = read_pid
      fail 'No valid PID file.' unless pid && pid > 0
      Process.kill('TERM', pid)
      delete_pid
      puts 'Process terminated.'
    end
469056
def finish(self):
    
    if self.proc is None:
      return None
    self.proc.stdin.close()
    for thread in (self._out_thread, self._err_thread):
      thread.join()
    (out, err) = [
        b"".join(chunks) for chunks in (self._out_chunks, self._err_chunks)
    ]
    self.proc.stdout.close()
    self.proc.stderr.close()
    if self.proc.returncode:
      err = "\n".join([" ".join(self.cmd), err.decode("utf8")])
      raise IOError(err)
    del self.proc
    self.proc = None
    return out
254642
def shutdown(exception)
      begin
        notify_event(:shutdown, { :exception_message => exception.message })
      rescue => e
        $stderr.puts([e.message, e.backtrace].join("\n")) rescue nil
      end
      @config = default_config
      @config[:enabled] = false
    end
539482
def close(self, terminate=True, kill=False):
        '''
        
        '''
        if not self.closed:
            if self.child_fd is not None:
                os.close(self.child_fd)
                self.child_fd = None
            if self.child_fde is not None:
                os.close(self.child_fde)
                self.child_fde = None
            time.sleep(0.1)
            if terminate:
                if not self.terminate(kill):
                    raise TerminalException('Failed to terminate child process.')
            self.closed = True
1183425
def _terminate_procs(procs):
    
    logging.warn("Stopping all remaining processes")
    for proc, g in procs.values():
        logging.debug("[%s] SIGTERM", proc.pid)
        try:
            proc.terminate()
        except OSError as e:
            # we don't care if the process we tried to kill didn't exist.
            if e.errno != errno.ESRCH:
                raise
    sys.exit(1)
1220834
def close(self):
        
        if self._process:
            # Be nice first.
            self._process.send_signal(signal.SIGINT)

            # If it doesn't close itself promptly, be brutal.
            # Python 3.2+ added the timeout option to wait() and the
            # corresponding TimeoutExpired exception. If they exist, use them.
            if hasattr(subprocess, 'TimeoutExpired'):
                try:
                    self._process.wait(timeout=1)
                except subprocess.TimeoutExpired:
                    self._process.send_signal(signal.SIGKILL)

            # Otherwise, roll our own polling loop.
            else:
                # Give it 1s, checking every 10ms.
                count = 0
                while count < 100:
                    if self._process.poll() is not None:
                        break
                    time.sleep(0.01)

                # Still hasn't quit.
                if self._process.poll() is None:
                    self._process.send_signal(signal.SIGKILL)

            # Clean up.
            self._process = None
1254960
public void stop() throws Exception {

        final CountDownLatch latch = new CountDownLatch(1);
        this.serviceContainer.addTerminateListener(info -> latch.countDown());
        this.serviceContainer.shutdown();

        latch.await();

        executor.submit(new Runnable() {
            @Override
            public void run() {
                TempFileManager.deleteRecursively(tmpDir);
            }
        });
        executor.shutdown();
    }
1273678
public void terminate()
	{
		log( "term" );

		fActivated = false;
		converter = null;

		source.removePropertyChangedHandler( sourceHandler );
		source = null;
		sourceHandler = null;

		destination.removePropertyChangedHandler( destinationHandler );
		destination = null;
		destinationHandler = null;

	}
601708
def terminate(self):
        

        for process in list(self.processes):
            process["subprocess"].send_signal(signal.SIGTERM)

        self.stop_watch()
978980
def stop_process(process):
    """"""
    process.terminate()
    process.join(3)

    if process.is_alive() and os.name != 'nt':
        try:
            os.kill(process.pid, signal.SIGKILL)
            process.join()
        except OSError:
            return

    if process.is_alive():
        raise RuntimeError("Unable to terminate PID %d" % os.getpid())
90927
public function stop()
    {
        if ($this->pid) {
            exec('kill ' . $this->pid, $output, $ret);
            if ($ret !== 0) {
                throw new Exception('Error stopping build-in server.');
            }
            $this->pid = null;
        }
    }
257822
@Override public void stop() {
        lock.lock();
        try {
            if (process != null) {
                destroyProcess();
            }
            process = null;
        } finally {
            lock.unlock();
        }
    }
776199
def terminate(pid, sig, timeout):
    ''''''
    os.kill(pid, sig)
    start = time.time()
    while True:
        try:
            # This is requireed if it's our child to avoid zombie. Also
            # is_running() returns True for zombie process.
            _, status = os.waitpid(pid, os.WNOHANG)
        except OSError as exc:
            if exc.errno != errno.ECHILD: # pragma: nocover
                raise
        else:
            if status:
                return True
        if not is_running(pid):
            return True
        if time.time()-start>=timeout:
            return False
        time.sleep(0.1)
940939
public int execute() throws IOException
    {
        Runtime runtime = Runtime.getRuntime();

        int exitCode = -1;
        TerminateProcessThread terminateProcess = null;
        Process process = null;

        try
        {
            // Execute the command
            String[] command = (String[]) this.command.toArray(new String[this.command.size()]);

            if (this.workingDirectory != null)
            {
                process = runtime.exec(command, null, this.workingDirectory);
            }
            else
            {
                process = runtime.exec(command);
            }

            // Start the stream handler
            this.handler.setErrorStream(process.getErrorStream());
            this.handler.setInputStream(process.getInputStream());
            this.handler.setOutputStream(process.getOutputStream());

            this.handler.start();

            // Setup the thread to terminate the process if the JVM is shut down
            if (this.terminateOnJvmExit)
            {
                terminateProcess = new TerminateProcessThread(process);
                runtime.addShutdownHook(terminateProcess);
            }

            exitCode = process.waitFor();
        }
        catch (InterruptedException e)
        {
            process.destroy();
        }
        finally
        {
            // Stop the stream handler
            this.handler.stop();

            // Remove the terminate hook
            if (terminateProcess != null)
            {
                runtime.removeShutdownHook(terminateProcess);
            }

            // Close off the streams
            if (process != null)
            {
                closeStreams(process);
            }
        }

        return exitCode;
    }
562401
def terminate(self):
        
        self.handle, handle = None, self.handle
        if threading.current_thread() is self._event_thread:
            # Handle special case to allow event handle to be detached.
            # This is necessary since otherwise the event thread would deadlock itself.
            grim_reaper = threading.Thread(target=lambda: _mpv_terminate_destroy(handle))
            grim_reaper.start()
        else:
            _mpv_terminate_destroy(handle)
            if self._event_thread:
                self._event_thread.join()