summaryrefslogtreecommitdiff
path: root/it_pipe.class
diff options
context:
space:
mode:
authorUrban Müller2019-03-18 14:06:05 +0100
committerUrban Müller2019-03-18 14:06:05 +0100
commit2ea5b7afb01c78b87176f21356197bc8fb617023 (patch)
tree46140956556ef984ef3187ae6df9fc5974fb4c0a /it_pipe.class
parent4d1b92f1d4e9f2f80d04b452246399cb40bb543d (diff)
downloaditools-2ea5b7afb01c78b87176f21356197bc8fb617023.tar.gz
itools-2ea5b7afb01c78b87176f21356197bc8fb617023.tar.bz2
itools-2ea5b7afb01c78b87176f21356197bc8fb617023.zip
support cmd line args in ->pipe()
Diffstat (limited to 'it_pipe.class')
-rw-r--r--it_pipe.class9
1 files changed, 7 insertions, 2 deletions
diff --git a/it_pipe.class b/it_pipe.class
index ea3010d..7408f69 100644
--- a/it_pipe.class
+++ b/it_pipe.class
@@ -226,10 +226,15 @@ function lines()
}
/**
- * Pipe our contents through a shell command
+ * Pipe our contents through a shell command.
+ * @param $cmd command to execute, with {foo} for parameters
+ * @param $args assoc array of arguments, see it::exec
*/
-function pipe($cmd)
+function pipe(/* $cmd, $args */)
{
+ $args = func_get_args();
+ $cmd = call_user_func_array('it::shell_command', $args);
+
$descriptors = array(0 => array("pipe", "r"), 1 => array("pipe", "w"));
$process = proc_open($cmd, $descriptors, $pipes);