From 2f30e4e2f6670bdb25fdf2bc45cf54b42a8dd643 Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Sat, 11 Jun 2011 00:44:32 +0200 Subject: [PATCH] Fix a regression introduced with commit 20c3f14cc: If we can read from a process' pipe doesn't mean the exit code of the process in question is zero, this is actually what pclose() returns. --- src/IDF/Scm.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/IDF/Scm.php b/src/IDF/Scm.php index 708b02a..5ebb8d9 100644 --- a/src/IDF/Scm.php +++ b/src/IDF/Scm.php @@ -101,16 +101,15 @@ class IDF_Scm */ public static function exec($caller, $cmd, &$out=null, &$return=null) { - $return = 1; + $return = -1; Pluf_Log::stime('timer'); $fp = popen($cmd, 'r'); $buf = ''; if ($fp !== false) { - $return = 0; while (!feof($fp)) { $buf .= fread($fp, 1024); } - pclose($fp); + $return = pclose($fp); } $out = preg_split('/\r\n|\r|\n/', $buf); $elem = count($out);