diff options
author | Urban Müller | 2019-05-10 16:48:45 +0200 |
---|---|---|
committer | Urban Müller | 2019-05-10 16:49:57 +0200 |
commit | 7758be802e3011f6430ad17912fa2b4ab51ed7a3 (patch) | |
tree | 901dc073079f117f737fe8079316f2397cee244d /it_pipe.class | |
parent | ac0de5daec59494c93dfcfa798b63b4da883d156 (diff) | |
download | itools-7758be802e3011f6430ad17912fa2b4ab51ed7a3.tar.gz itools-7758be802e3011f6430ad17912fa2b4ab51ed7a3.tar.bz2 itools-7758be802e3011f6430ad17912fa2b4ab51ed7a3.zip |
handle empty output in ->pipe()
Diffstat (limited to 'it_pipe.class')
-rw-r--r-- | it_pipe.class | 3 |
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); |