Skip to content

Commit daadf86

Browse files
committed
fix: prevent Process::close() double execution
1 parent f2c536a commit daadf86

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Process.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,9 @@ public function close()
297297
return;
298298
}
299299

300+
$process = $this->process;
301+
$this->process = null;
302+
300303
foreach ($this->pipes as $pipe) {
301304
$pipe->close();
302305
}
@@ -306,8 +309,7 @@ public function close()
306309
$this->closeExitCodePipe();
307310
}
308311

309-
$exitCode = \proc_close($this->process);
310-
$this->process = null;
312+
$exitCode = \proc_close($process);
311313

312314
if ($this->exitCode === null && $exitCode !== -1) {
313315
$this->exitCode = $exitCode;

0 commit comments

Comments
 (0)