Close the process opened by this worker.

@return void
172734
protected function closeProcess()
    {
        if (! is_resource($this->process)) {
            return;
        }

        $procCloseFn = 'proc_close';
        if (!$this->resourceOpen instanceof ProcOpen) {
            $procCloseFn = 'fclose';
        }

        call_user_func($procCloseFn, $this->process);
    }
290586
public function stop(): bool
    {
        $this->process->getPid()->onResolve(function ($error, $pid) {
            if ($error) {
                throw new ProcessException($error);
            }

            print "\nStopping Process Id: {$pid}\n";

            if ('\\' === \DIRECTORY_SEPARATOR) {
                \exec(\sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
                if ($exitCode) {
                    throw new ProcessException(\sprintf('Unable to kill the process (%s).', \implode(' ', $output)));
                }
            } else {
                $this->process->signal(15);

                if ($ok = \proc_open("kill $pid", [2 => ['pipe', 'w']], $pipes)) {
                    $ok = false === \fgets($pipes[2]);
                }

                if (!$ok) {
                    throw new ProcessException(\sprintf('Error while killing process "%s".', $pid));
                }
            }

            $this->process->kill();
        });

        return true;
    }
1272545
public function close()
    {
        if (false === $this->openned) {
            return false;
        }
        $this->pclzip = $this->filename = null;
        $this->openned = false;
        if (file_exists(self::TMP_DIR)) {
            $this->_rrmdir(self::TMP_DIR);
            rmdir(self::TMP_DIR);
        }
        return true;
    }
696662
private function quit()
    {
        $this->output->writeln('Stopping the process manager.');

        // this method is also called during startup when something crashed, so
        // make sure we don't operate on nulls.
        if ($this->controller) {
            @$this->controller->close();
        }
        if ($this->web) {
            @$this->web->close();
        }

        if ($this->loop) {
            $this->loop->stop();
        }

        unlink($this->pidfile);
        exit;
    }
501107
public function close()
    {
        if (is_resource($this->curl)) {
            curl_close($this->curl);
        }
        $this->options = null;
        $this->jsonDecoder = null;
        $this->xmlDecoder = null;
    }
134535
public function close()
    {
        $stmt = null;
        $stmt = $this->getDbStatement(self::cyrus()->getDatabase());

        $stmt->closeCursor();
        $this->pdo = null;
        $this->closed = true;
    }
1240370
function _close()
	{
		if ($this->connection->_stmt === $this->_queryID) {
			$this->connection->_stmt = false;
		}
		if (!empty($this->_refcursor)) {
			oci_free_cursor($this->_refcursor);
			$this->_refcursor = false;
		}
		@oci_free_statement($this->_queryID);
		$this->_queryID = false;
	}
1097683
public function close()
	{
		if (!$this->fh)
		{
			throw new \RuntimeException('File not open');
		}

		// Capture PHP errors
		$php_errormsg = 'Error Unknown';
		$track_errors = ini_get('track_errors');
		ini_set('track_errors', true);

		switch ($this->processingmethod)
		{
			case 'gz':
				$res = gzclose($this->fh);
				break;

			case 'bz':
				$res = bzclose($this->fh);
				break;

			case 'f':
			default:
				$res = fclose($this->fh);
				break;
		}

		if (!$res)
		{
			throw new \RuntimeException($php_errormsg);
		}
		else
		{
			// Reset this
			$this->fh = null;
		}

		// If we wrote, chmod the file after it's closed
		if ($this->openmode[0] == 'w')
		{
			$this->chmod();
		}

		// Restore error tracking to what it was before
		ini_set('track_errors', $track_errors);

		// Return the result
		return true;
	}
1055106
public function close() {
		if ($this->type === YesfSwoole::LISTEN_UNIX || $this->type === YesfSwoole::LISTEN_UNIX_DGRAM) {
			$key = $this->config['sock'];
		} else {
			$key = $this->config['port'];
		}
		$this->listener = null;
		unset(self::$listened[$key]);
	}
26742
public function close()
    {
        $this->ending = true;

        foreach ($this->pending as $deferred) {
            $deferred->reject(new RuntimeException('Shell is ending'));
        }
        $this->pending = array();
        $this->buffer = '';

        $this->stream->removeListener('data', array($this, 'handleData'));
        $this->stream->removeListener('end', array($this, 'handleEnd'));

        $this->stream->close();
    }
1273269
public function close()
    {
        if (is_null($this->_con)) {
            return;
        }
        \oci_close($this->_con);
        $this->_con = null;
    }
597272
function close()
    {
        if ( $this->ClusteringEnabled )
        {
            $this->ClusterHandler = null;
            return;
        }

        if ( $this->FileResource )
        {
            fclose( $this->FileResource );

            if ( $this->isAtomic )
            {
                eZFile::rename( $this->tmpFilename, $this->requestedFilename, false, eZFile::CLEAN_ON_FAILURE );
            }
            $this->FileResource = false;
        }
    }
155056
private function close(): int
    {
        $this->processPipes->close();
        if (\is_resource($this->process)) {
            proc_close($this->process);
        }
        $this->exitcode = $this->processInformation['exitcode'];
        $this->status = self::STATUS_TERMINATED;

        if (-1 === $this->exitcode) {
            if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
                // if process has been signaled, no exitcode but a valid termsig, apply Unix convention
                $this->exitcode = 128 + $this->processInformation['termsig'];
            } elseif ($this->isSigchildEnabled()) {
                $this->processInformation['signaled'] = true;
                $this->processInformation['termsig'] = -1;
            }
        }

        // Free memory from self-reference callback created by buildCallback
        // Doing so in other contexts like __destruct or by garbage collector is ineffective
        // Now pipes are closed, so the callback is no longer necessary
        $this->callback = null;

        return $this->exitcode;
    }
1318236
public function close() {
		if ($this->redistype == 'redis')
			$this->connection->close();
		$this->connection = null;
		$this->verified_params = null;
	}
151939
def close(self):
        '''
        '''
        if not self._process:
            return

        if self._process.returncode is not None:
            return

        _logger.debug('Terminate process.')

        try:
            self._process.terminate()
        except OSError as error:
            if error.errno != errno.ESRCH:
                raise

        for dummy in range(10):
            if self._process.returncode is not None:
                return

            time.sleep(0.05)

        _logger.debug('Failed to terminate. Killing.')

        try:
            self._process.kill()
        except OSError as error:
            if error.errno != errno.ESRCH:
                raise
854164
public function handleClose()
    {
        $this->pause();

        if (is_resource($this->socket))
        {
            if ($this->getStreamType() === Socket::TYPE_UNIX)
            {
                $path = substr($this->parseEndpoint(), 7);
                unlink($path);
            }
            fclose($this->socket);
        }
    }
1007450
public function shutdownProcesses()
    {
        foreach ($this->processes as $pid => $process) {
            unset($this->processes[$pid]);
    
            posix_kill($pid, SIGUSR1);
        }
    
        exit;
    }