Skip to content

Commit

Permalink
Don't use is_resource() on non-streams
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Sep 5, 2024
1 parent deedcb3 commit 32354f6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ public function start(?callable $callback = null, array $env = [])

$this->process = @proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $this->options);

if (!\is_resource($this->process)) {
if (!$this->process) {
throw new RuntimeException('Unable to launch a new process.');
}
$this->status = self::STATUS_STARTED;
Expand Down Expand Up @@ -1456,8 +1456,9 @@ private function readPipes(bool $blocking, bool $close)
private function close(): int
{
$this->processPipes->close();
if (\is_resource($this->process)) {
if ($this->process) {
proc_close($this->process);
$this->process = null;
}
$this->exitcode = $this->processInformation['exitcode'];
$this->status = self::STATUS_TERMINATED;
Expand Down

0 comments on commit 32354f6

Please sign in to comment.