Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes
This commit is contained in:
parent
b11a755ba8
commit
c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions
vendor/symfony/process
287
vendor/symfony/process/Process.php
vendored
287
vendor/symfony/process/Process.php
vendored
|
@ -54,7 +54,7 @@ class Process
|
|||
private $idleTimeout;
|
||||
private $options;
|
||||
private $exitcode;
|
||||
private $fallbackExitcode;
|
||||
private $fallbackStatus = array();
|
||||
private $processInformation;
|
||||
private $outputDisabled = false;
|
||||
private $stdout;
|
||||
|
@ -169,8 +169,7 @@ class Process
|
|||
|
||||
public function __destruct()
|
||||
{
|
||||
// stop() will check if we have a process running.
|
||||
$this->stop();
|
||||
$this->stop(0);
|
||||
}
|
||||
|
||||
public function __clone()
|
||||
|
@ -219,7 +218,7 @@ class Process
|
|||
*/
|
||||
public function mustRun($callback = null)
|
||||
{
|
||||
if ($this->isSigchildEnabled() && !$this->enhanceSigchildCompatibility) {
|
||||
if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
|
||||
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
|
||||
}
|
||||
|
||||
|
@ -241,9 +240,6 @@ class Process
|
|||
* The callback receives the type of output (out or err) and some bytes from
|
||||
* the output in real-time while writing the standard input to the process.
|
||||
* It allows to have feedback from the independent process during execution.
|
||||
* If there is no callback passed, the wait() method can be called
|
||||
* with true as a second parameter then the callback will get all data occurred
|
||||
* in (and since) the start call.
|
||||
*
|
||||
* @param callable|null $callback A PHP callback to run whenever there is some
|
||||
* output available on STDOUT or STDERR
|
||||
|
@ -278,6 +274,17 @@ class Process
|
|||
if (!isset($this->options['bypass_shell'])) {
|
||||
$this->options['bypass_shell'] = true;
|
||||
}
|
||||
} elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
|
||||
// last exit code is output on the fourth pipe and caught to work around --enable-sigchild
|
||||
$descriptors[3] = array('pipe', 'w');
|
||||
|
||||
// See https://unix.stackexchange.com/questions/71205/background-process-pipe-input
|
||||
$commandline = '{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
|
||||
$commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
|
||||
|
||||
// Workaround for the bug, when PTS functionality is enabled.
|
||||
// @see : https://bugs.php.net/69442
|
||||
$ptsWorkaround = fopen(__FILE__, 'r');
|
||||
}
|
||||
|
||||
$this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);
|
||||
|
@ -287,6 +294,10 @@ class Process
|
|||
}
|
||||
$this->status = self::STATUS_STARTED;
|
||||
|
||||
if (isset($descriptors[3])) {
|
||||
$this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
|
||||
}
|
||||
|
||||
if ($this->tty) {
|
||||
return;
|
||||
}
|
||||
|
@ -349,8 +360,7 @@ class Process
|
|||
do {
|
||||
$this->checkTimeout();
|
||||
$running = '\\' === DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
|
||||
$close = '\\' !== DIRECTORY_SEPARATOR || !$running;
|
||||
$this->readPipes(true, $close);
|
||||
$this->readPipes($running, '\\' !== DIRECTORY_SEPARATOR || !$running);
|
||||
} while ($running);
|
||||
|
||||
while ($this->isRunning()) {
|
||||
|
@ -368,17 +378,9 @@ class Process
|
|||
* Returns the Pid (process identifier), if applicable.
|
||||
*
|
||||
* @return int|null The process id if running, null otherwise
|
||||
*
|
||||
* @throws RuntimeException In case --enable-sigchild is activated
|
||||
*/
|
||||
public function getPid()
|
||||
{
|
||||
if ($this->isSigchildEnabled()) {
|
||||
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. The process identifier can not be retrieved.');
|
||||
}
|
||||
|
||||
$this->updateStatus(false);
|
||||
|
||||
return $this->isRunning() ? $this->processInformation['pid'] : null;
|
||||
}
|
||||
|
||||
|
@ -390,7 +392,7 @@ class Process
|
|||
* @return Process
|
||||
*
|
||||
* @throws LogicException In case the process is not running
|
||||
* @throws RuntimeException In case --enable-sigchild is activated
|
||||
* @throws RuntimeException In case --enable-sigchild is activated and the process can't be killed
|
||||
* @throws RuntimeException In case of failure
|
||||
*/
|
||||
public function signal($signal)
|
||||
|
@ -460,15 +462,13 @@ class Process
|
|||
*/
|
||||
public function getOutput()
|
||||
{
|
||||
if ($this->outputDisabled) {
|
||||
throw new LogicException('Output has been disabled.');
|
||||
$this->readPipesForOutput(__FUNCTION__);
|
||||
|
||||
if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$this->requireProcessIsStarted(__FUNCTION__);
|
||||
|
||||
$this->readPipes(false, '\\' === DIRECTORY_SEPARATOR ? !$this->processInformation['running'] : true);
|
||||
|
||||
return $this->stdout;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -484,18 +484,15 @@ class Process
|
|||
*/
|
||||
public function getIncrementalOutput()
|
||||
{
|
||||
$this->requireProcessIsStarted(__FUNCTION__);
|
||||
$this->readPipesForOutput(__FUNCTION__);
|
||||
|
||||
$data = $this->getOutput();
|
||||
|
||||
$latest = substr($data, $this->incrementalOutputOffset);
|
||||
$latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
|
||||
$this->incrementalOutputOffset = ftell($this->stdout);
|
||||
|
||||
if (false === $latest) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$this->incrementalOutputOffset = strlen($data);
|
||||
|
||||
return $latest;
|
||||
}
|
||||
|
||||
|
@ -506,7 +503,8 @@ class Process
|
|||
*/
|
||||
public function clearOutput()
|
||||
{
|
||||
$this->stdout = '';
|
||||
ftruncate($this->stdout, 0);
|
||||
fseek($this->stdout, 0);
|
||||
$this->incrementalOutputOffset = 0;
|
||||
|
||||
return $this;
|
||||
|
@ -522,15 +520,13 @@ class Process
|
|||
*/
|
||||
public function getErrorOutput()
|
||||
{
|
||||
if ($this->outputDisabled) {
|
||||
throw new LogicException('Output has been disabled.');
|
||||
$this->readPipesForOutput(__FUNCTION__);
|
||||
|
||||
if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$this->requireProcessIsStarted(__FUNCTION__);
|
||||
|
||||
$this->readPipes(false, '\\' === DIRECTORY_SEPARATOR ? !$this->processInformation['running'] : true);
|
||||
|
||||
return $this->stderr;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -547,18 +543,15 @@ class Process
|
|||
*/
|
||||
public function getIncrementalErrorOutput()
|
||||
{
|
||||
$this->requireProcessIsStarted(__FUNCTION__);
|
||||
$this->readPipesForOutput(__FUNCTION__);
|
||||
|
||||
$data = $this->getErrorOutput();
|
||||
|
||||
$latest = substr($data, $this->incrementalErrorOutputOffset);
|
||||
$latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
|
||||
$this->incrementalErrorOutputOffset = ftell($this->stderr);
|
||||
|
||||
if (false === $latest) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$this->incrementalErrorOutputOffset = strlen($data);
|
||||
|
||||
return $latest;
|
||||
}
|
||||
|
||||
|
@ -569,7 +562,8 @@ class Process
|
|||
*/
|
||||
public function clearErrorOutput()
|
||||
{
|
||||
$this->stderr = '';
|
||||
ftruncate($this->stderr, 0);
|
||||
fseek($this->stderr, 0);
|
||||
$this->incrementalErrorOutputOffset = 0;
|
||||
|
||||
return $this;
|
||||
|
@ -584,7 +578,7 @@ class Process
|
|||
*/
|
||||
public function getExitCode()
|
||||
{
|
||||
if ($this->isSigchildEnabled() && !$this->enhanceSigchildCompatibility) {
|
||||
if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
|
||||
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
|
||||
}
|
||||
|
||||
|
@ -601,8 +595,6 @@ class Process
|
|||
*
|
||||
* @return null|string A string representation for the exit status code, null if the Process is not terminated.
|
||||
*
|
||||
* @throws RuntimeException In case --enable-sigchild is activated and the sigchild compatibility mode is disabled
|
||||
*
|
||||
* @see http://tldp.org/LDP/abs/html/exitcodes.html
|
||||
* @see http://en.wikipedia.org/wiki/Unix_signal
|
||||
*/
|
||||
|
@ -639,12 +631,10 @@ class Process
|
|||
{
|
||||
$this->requireProcessIsTerminated(__FUNCTION__);
|
||||
|
||||
if ($this->isSigchildEnabled()) {
|
||||
if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
|
||||
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
|
||||
}
|
||||
|
||||
$this->updateStatus(false);
|
||||
|
||||
return $this->processInformation['signaled'];
|
||||
}
|
||||
|
||||
|
@ -662,12 +652,10 @@ class Process
|
|||
{
|
||||
$this->requireProcessIsTerminated(__FUNCTION__);
|
||||
|
||||
if ($this->isSigchildEnabled()) {
|
||||
if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) {
|
||||
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
|
||||
}
|
||||
|
||||
$this->updateStatus(false);
|
||||
|
||||
return $this->processInformation['termsig'];
|
||||
}
|
||||
|
||||
|
@ -684,8 +672,6 @@ class Process
|
|||
{
|
||||
$this->requireProcessIsTerminated(__FUNCTION__);
|
||||
|
||||
$this->updateStatus(false);
|
||||
|
||||
return $this->processInformation['stopped'];
|
||||
}
|
||||
|
||||
|
@ -702,8 +688,6 @@ class Process
|
|||
{
|
||||
$this->requireProcessIsTerminated(__FUNCTION__);
|
||||
|
||||
$this->updateStatus(false);
|
||||
|
||||
return $this->processInformation['stopsig'];
|
||||
}
|
||||
|
||||
|
@ -763,41 +747,33 @@ class Process
|
|||
* Stops the process.
|
||||
*
|
||||
* @param int|float $timeout The timeout in seconds
|
||||
* @param int $signal A POSIX signal to send in case the process has not stop at timeout, default is SIGKILL
|
||||
* @param int $signal A POSIX signal to send in case the process has not stop at timeout, default is SIGKILL (9)
|
||||
*
|
||||
* @return int The exit-code of the process
|
||||
*
|
||||
* @throws RuntimeException if the process got signaled
|
||||
*/
|
||||
public function stop($timeout = 10, $signal = null)
|
||||
{
|
||||
$timeoutMicro = microtime(true) + $timeout;
|
||||
if ($this->isRunning()) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR && !$this->isSigchildEnabled()) {
|
||||
exec(sprintf('taskkill /F /T /PID %d 2>&1', $this->getPid()), $output, $exitCode);
|
||||
if ($exitCode > 0) {
|
||||
throw new RuntimeException('Unable to kill the process');
|
||||
}
|
||||
}
|
||||
// given `SIGTERM` may not be defined and that `proc_terminate` uses the constant value and not the constant itself, we use the same here
|
||||
$this->doSignal(15, false);
|
||||
do {
|
||||
usleep(1000);
|
||||
} while ($this->isRunning() && microtime(true) < $timeoutMicro);
|
||||
|
||||
if ($this->isRunning() && !$this->isSigchildEnabled()) {
|
||||
if (null !== $signal || defined('SIGKILL')) {
|
||||
// avoid exception here :
|
||||
// process is supposed to be running, but it might have stop
|
||||
// just after this line.
|
||||
// in any case, let's silently discard the error, we can not do anything
|
||||
$this->doSignal($signal ?: SIGKILL, false);
|
||||
}
|
||||
if ($this->isRunning()) {
|
||||
// Avoid exception here: process is supposed to be running, but it might have stopped just
|
||||
// after this line. In any case, let's silently discard the error, we cannot do anything.
|
||||
$this->doSignal($signal ?: 9, false);
|
||||
}
|
||||
}
|
||||
|
||||
$this->updateStatus(false);
|
||||
if ($this->processInformation['running']) {
|
||||
if ($this->isRunning()) {
|
||||
if (isset($this->fallbackStatus['pid'])) {
|
||||
unset($this->fallbackStatus['pid']);
|
||||
|
||||
return $this->stop(0, $signal);
|
||||
}
|
||||
$this->close();
|
||||
}
|
||||
|
||||
|
@ -807,23 +783,33 @@ class Process
|
|||
/**
|
||||
* Adds a line to the STDOUT stream.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param string $line The line to append
|
||||
*/
|
||||
public function addOutput($line)
|
||||
{
|
||||
$this->lastOutputTime = microtime(true);
|
||||
$this->stdout .= $line;
|
||||
|
||||
fseek($this->stdout, 0, SEEK_END);
|
||||
fwrite($this->stdout, $line);
|
||||
fseek($this->stdout, $this->incrementalOutputOffset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a line to the STDERR stream.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param string $line The line to append
|
||||
*/
|
||||
public function addErrorOutput($line)
|
||||
{
|
||||
$this->lastOutputTime = microtime(true);
|
||||
$this->stderr .= $line;
|
||||
|
||||
fseek($this->stderr, 0, SEEK_END);
|
||||
fwrite($this->stderr, $line);
|
||||
fseek($this->stderr, $this->incrementalErrorOutputOffset);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1228,14 +1214,7 @@ class Process
|
|||
return $result = false;
|
||||
}
|
||||
|
||||
$proc = @proc_open('echo 1', array(array('pty'), array('pty'), array('pty')), $pipes);
|
||||
if (is_resource($proc)) {
|
||||
proc_close($proc);
|
||||
|
||||
return $result = true;
|
||||
}
|
||||
|
||||
return $result = false;
|
||||
return $result = (bool) @proc_open('echo 1', array(array('pty'), array('pty'), array('pty')), $pipes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1250,16 +1229,8 @@ class Process
|
|||
} else {
|
||||
$this->processPipes = UnixPipes::create($this, $this->input);
|
||||
}
|
||||
$descriptors = $this->processPipes->getDescriptors($this->outputDisabled);
|
||||
|
||||
if (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
|
||||
// last exit code is output on the fourth pipe and caught to work around --enable-sigchild
|
||||
$descriptors = array_merge($descriptors, array(array('pipe', 'w')));
|
||||
|
||||
$this->commandline = '('.$this->commandline.') 3>/dev/null; code=$?; echo $code >&3; exit $code';
|
||||
}
|
||||
|
||||
return $descriptors;
|
||||
return $this->processPipes->getDescriptors();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1303,11 +1274,15 @@ class Process
|
|||
}
|
||||
|
||||
$this->processInformation = proc_get_status($this->process);
|
||||
$this->captureExitCode();
|
||||
$running = $this->processInformation['running'];
|
||||
|
||||
$this->readPipes($blocking, '\\' === DIRECTORY_SEPARATOR ? !$this->processInformation['running'] : true);
|
||||
$this->readPipes($running && $blocking, '\\' !== DIRECTORY_SEPARATOR || !$running);
|
||||
|
||||
if (!$this->processInformation['running']) {
|
||||
if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
|
||||
$this->processInformation = $this->fallbackStatus + $this->processInformation;
|
||||
}
|
||||
|
||||
if (!$running) {
|
||||
$this->close();
|
||||
}
|
||||
}
|
||||
|
@ -1323,7 +1298,7 @@ class Process
|
|||
return self::$sigchild;
|
||||
}
|
||||
|
||||
if (!function_exists('phpinfo')) {
|
||||
if (!function_exists('phpinfo') || defined('HHVM_VERSION')) {
|
||||
return self::$sigchild = false;
|
||||
}
|
||||
|
||||
|
@ -1333,6 +1308,24 @@ class Process
|
|||
return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads pipes for the freshest output.
|
||||
*
|
||||
* @param $caller The name of the method that needs fresh outputs
|
||||
*
|
||||
* @throws LogicException in case output has been disabled or process is not started
|
||||
*/
|
||||
private function readPipesForOutput($caller)
|
||||
{
|
||||
if ($this->outputDisabled) {
|
||||
throw new LogicException('Output has been disabled.');
|
||||
}
|
||||
|
||||
$this->requireProcessIsStarted($caller);
|
||||
|
||||
$this->updateStatus(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates and returns the filtered timeout.
|
||||
*
|
||||
|
@ -1367,24 +1360,14 @@ class Process
|
|||
|
||||
$callback = $this->callback;
|
||||
foreach ($result as $type => $data) {
|
||||
if (3 == $type) {
|
||||
$this->fallbackExitcode = (int) $data;
|
||||
} else {
|
||||
if (3 !== $type) {
|
||||
$callback($type === self::STDOUT ? self::OUT : self::ERR, $data);
|
||||
} elseif (!isset($this->fallbackStatus['signaled'])) {
|
||||
$this->fallbackStatus['exitcode'] = (int) $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Captures the exitcode if mentioned in the process information.
|
||||
*/
|
||||
private function captureExitCode()
|
||||
{
|
||||
if (isset($this->processInformation['exitcode']) && -1 != $this->processInformation['exitcode']) {
|
||||
$this->exitcode = $this->processInformation['exitcode'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes process resource, closes file handles, sets the exitcode.
|
||||
*
|
||||
|
@ -1394,21 +1377,26 @@ class Process
|
|||
{
|
||||
$this->processPipes->close();
|
||||
if (is_resource($this->process)) {
|
||||
$exitcode = proc_close($this->process);
|
||||
} else {
|
||||
$exitcode = -1;
|
||||
proc_close($this->process);
|
||||
}
|
||||
|
||||
$this->exitcode = -1 !== $exitcode ? $exitcode : (null !== $this->exitcode ? $this->exitcode : -1);
|
||||
$this->exitcode = $this->processInformation['exitcode'];
|
||||
$this->status = self::STATUS_TERMINATED;
|
||||
|
||||
if (-1 === $this->exitcode && null !== $this->fallbackExitcode) {
|
||||
$this->exitcode = $this->fallbackExitcode;
|
||||
} elseif (-1 === $this->exitcode && $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'];
|
||||
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->enhanceSigchildCompatibility && $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;
|
||||
}
|
||||
|
||||
|
@ -1420,10 +1408,10 @@ class Process
|
|||
$this->starttime = null;
|
||||
$this->callback = null;
|
||||
$this->exitcode = null;
|
||||
$this->fallbackExitcode = null;
|
||||
$this->fallbackStatus = array();
|
||||
$this->processInformation = null;
|
||||
$this->stdout = null;
|
||||
$this->stderr = null;
|
||||
$this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+');
|
||||
$this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+');
|
||||
$this->process = null;
|
||||
$this->latestSignal = null;
|
||||
$this->status = self::STATUS_READY;
|
||||
|
@ -1440,12 +1428,12 @@ class Process
|
|||
* @return bool True if the signal was sent successfully, false otherwise
|
||||
*
|
||||
* @throws LogicException In case the process is not running
|
||||
* @throws RuntimeException In case --enable-sigchild is activated
|
||||
* @throws RuntimeException In case --enable-sigchild is activated and the process can't be killed
|
||||
* @throws RuntimeException In case of failure
|
||||
*/
|
||||
private function doSignal($signal, $throwException)
|
||||
{
|
||||
if (!$this->isRunning()) {
|
||||
if (null === $pid = $this->getPid()) {
|
||||
if ($throwException) {
|
||||
throw new LogicException('Can not send signal on a non running process.');
|
||||
}
|
||||
|
@ -1453,23 +1441,36 @@ class Process
|
|||
return false;
|
||||
}
|
||||
|
||||
if ($this->isSigchildEnabled()) {
|
||||
if ($throwException) {
|
||||
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. The process can not be signaled.');
|
||||
}
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
|
||||
if ($exitCode && $this->isRunning()) {
|
||||
if ($throwException) {
|
||||
throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
|
||||
$ok = @proc_terminate($this->process, $signal);
|
||||
} elseif (function_exists('posix_kill')) {
|
||||
$ok = @posix_kill($pid, $signal);
|
||||
} elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
|
||||
$ok = false === fgets($pipes[2]);
|
||||
}
|
||||
if (!$ok) {
|
||||
if ($throwException) {
|
||||
throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (true !== @proc_terminate($this->process, $signal)) {
|
||||
if ($throwException) {
|
||||
throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->latestSignal = $signal;
|
||||
$this->latestSignal = (int) $signal;
|
||||
$this->fallbackStatus['signaled'] = true;
|
||||
$this->fallbackStatus['exitcode'] = -1;
|
||||
$this->fallbackStatus['termsig'] = $this->latestSignal;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Reference in a new issue