]> git.andy128k.dev Git - missing-tools.git/commitdiff
add shell tools
authorAndrey Kutejko <andy128k@gmail.com>
Mon, 14 Apr 2014 16:42:26 +0000 (19:42 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Mon, 14 Apr 2014 16:42:26 +0000 (19:42 +0300)
src/shell.php [new file with mode: 0644]

diff --git a/src/shell.php b/src/shell.php
new file mode 100644 (file)
index 0000000..03e8468
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+namespace PFF;
+
+class Shell
+{
+    public static function call()
+    {
+        return self::callv(func_get_args());
+    }
+
+    public static function callv($command)
+    {
+        $str = '';
+        foreach ($command as $part) {
+            $str .= escapeshellarg($part) . ' ';
+        }
+        $descriptorspec = array(
+            0 => STDIN,
+            1 => STDOUT,
+            2 => STDERR
+        );
+        $process = proc_open($str, $descriptorspec, $pipes);
+        proc_close($process);
+    }
+}
+