diff options
| author | Urban Müller | 2011-03-03 18:56:42 +0000 | 
|---|---|---|
| committer | Urban Müller | 2011-03-03 18:56:42 +0000 | 
| commit | 4340602f5f3fbcd6874b7cba101ed0fea1feb55a (patch) | |
| tree | ec66918d025c3b9336739f301ba76279d68d2117 | |
| parent | 77ed6c4e2492c8a9227925d6227d28f3d741d948 (diff) | |
| download | itools-4340602f5f3fbcd6874b7cba101ed0fea1feb55a.tar.gz itools-4340602f5f3fbcd6874b7cba101ed0fea1feb55a.tar.bz2 itools-4340602f5f3fbcd6874b7cba101ed0fea1feb55a.zip  | |
allow multiple or no (=stdin) fn
| -rw-r--r-- | it_pipe.class | 5 | 
1 files changed, 4 insertions, 1 deletions
diff --git a/it_pipe.class b/it_pipe.class index 838fa39..3bfcfff 100644 --- a/it_pipe.class +++ b/it_pipe.class @@ -13,8 +13,11 @@ 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'])));  	else -		$this->lines = isset($p['fn']) ? file($p['fn'], FILE_IGNORE_NEW_LINES) : explode("\n", rtrim(it::exec($p['cmd'], $p['args']))); +		foreach ((array)($p['fn'] ? $p['fn'] : "php://stdin") as $fn) +			$this->lines = array_merge((array)$this->lines, file($fn, FILE_IGNORE_NEW_LINES));   }  /**  |