Permalink
Browse files

[Process] Close pipes before calling proc_close to avoid deadlocks as…

… advised on the proc_close php.net documentation
  • Loading branch information...
1 parent f4227b5 commit e82a05d3e7f6c01d049a0fcdfa47ba271648eca6 @Seldaek Seldaek committed Apr 8, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/Symfony/Component/Process/Process.php
@@ -503,6 +503,12 @@ public function stop($timeout=10)
$time += 1000;
usleep(1000);
}
+
+ foreach ($this->pipes as $pipe) {
+ fclose($pipe);
+ }
+ $this->pipes = array();
+
$exitcode = proc_close($this->process);
$this->exitcode = -1 === $this->processInformation['exitcode'] ? $exitcode : $this->processInformation['exitcode'];
}

0 comments on commit e82a05d

Please sign in to comment.