summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2019-05-10 16:48:45 +0200
committerUrban Müller2019-05-10 16:49:57 +0200
commit7758be802e3011f6430ad17912fa2b4ab51ed7a3 (patch)
tree901dc073079f117f737fe8079316f2397cee244d
parentac0de5daec59494c93dfcfa798b63b4da883d156 (diff)
downloaditools-7758be802e3011f6430ad17912fa2b4ab51ed7a3.tar.gz
itools-7758be802e3011f6430ad17912fa2b4ab51ed7a3.tar.bz2
itools-7758be802e3011f6430ad17912fa2b4ab51ed7a3.zip
handle empty output in ->pipe()
-rw-r--r--it_pipe.class3
1 files changed, 2 insertions, 1 deletions
diff --git a/it_pipe.class b/it_pipe.class
index 54f4a5b..cd1b54f 100644
--- a/it_pipe.class
+++ b/it_pipe.class
@@ -239,7 +239,8 @@ function pipe($cmd, ...$args)
fwrite($pipes[0], join("\n", $this->lines) . ($this->lines ? "\n" :""));
fclose($pipes[0]);
- $this->lines = explode("\n", rtrim(stream_get_contents($pipes[1])));
+ $out = stream_get_contents($pipes[1]);
+ $this->lines = $out === "" ? [] : explode("\n", rtrim($out, "\n"));
fclose($pipes[1]);
proc_close($process);