diff options
author | Urban Müller | 2011-11-10 14:00:40 +0000 |
---|---|---|
committer | Urban Müller | 2011-11-10 14:00:40 +0000 |
commit | 57a154f994f21be1c78fb19d815116edd7eb4016 (patch) | |
tree | bef88be84412ccc11ab35ff698d0376289c0fb2d | |
parent | 629bbd3e1b84b8996eb34a3d176b61e24c3a1f9e (diff) | |
download | itools-57a154f994f21be1c78fb19d815116edd7eb4016.tar.gz itools-57a154f994f21be1c78fb19d815116edd7eb4016.tar.bz2 itools-57a154f994f21be1c78fb19d815116edd7eb4016.zip |
correctly handle empty output
-rw-r--r-- | it_pipe.class | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/it_pipe.class b/it_pipe.class index bed5537..f9e64e2 100644 --- a/it_pipe.class +++ b/it_pipe.class @@ -15,7 +15,7 @@ function __construct($p = array()) if ($p['data']) $this->lines = $p['data']; else if ($p['cmd']) - $this->lines = explode("\n", rtrim(it::exec($p['cmd'], $p['args']))); + $this->lines = strlen($data = it::exec($p['cmd'], $p['args'])) ? explode("\n", rtrim($data)) : array(); else foreach ((array)($p['fn'] ? $p['fn'] : "php://stdin") as $fn) $this->lines = array_merge((array)$this->lines, file($fn, FILE_IGNORE_NEW_LINES)); |