From fa6fb6fa807f06ee2587cda56f1052d616668ea9 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Thu, 3 Jan 2013 15:01:40 +0100 Subject: [PATCH] [Process] Do not reset stdout/stderr pipes on Interrupted system call When `stream_select` is called and return false because of an `Interrupted system call`, pipes are currently reset to an empty array. As a result, both error-output and output are empty whereas the exitcode is 0 (successful process). --- src/Symfony/Component/Process/Process.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index ba76255608..2235524619 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -338,10 +338,13 @@ class Process $w = null; $e = null; - $n = @stream_select($r, $w, $e, $this->timeout); + if (false === $n = @stream_select($r, $w, $e, $this->timeout)) { + $lastError = error_get_last(); - if (false === $n) { - $this->pipes = array(); + // stream_select returns false when the `select` system call is interrupted by an incoming signal + if (isset($lastError['message']) && false === stripos($lastError['message'], 'interrupted system call')) { + $this->pipes = array(); + } continue; }