You are here

private function Process::close in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/process/Process.php \Symfony\Component\Process\Process::close()

Closes process resource, closes file handles, sets the exitcode.

Return value

int The exitcode

2 calls to Process::close()
Process::stop in vendor/symfony/process/Process.php
Stops the process.
Process::updateStatus in vendor/symfony/process/Process.php
Updates the status of the process, reads pipes.

File

vendor/symfony/process/Process.php, line 1393

Class

Process
Process is a thin wrapper around proc_* functions to easily start independent PHP processes.

Namespace

Symfony\Component\Process

Code

private function close() {
  $this->processPipes
    ->close();
  if (is_resource($this->process)) {
    $exitcode = proc_close($this->process);
  }
  else {
    $exitcode = -1;
  }
  $this->exitcode = -1 !== $exitcode ? $exitcode : (null !== $this->exitcode ? $this->exitcode : -1);
  $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'];
  }
  return $this->exitcode;
}