summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
Diffstat (limited to 'it.class')
-rw-r--r--it.class26
1 files changed, 26 insertions, 0 deletions
diff --git a/it.class b/it.class
index 196b999..0d4cc06 100644
--- a/it.class
+++ b/it.class
@@ -504,6 +504,32 @@ static function exec(/* $cmd, $values1 = array(), ... */)
}
/**
+ * Construct shell command using it::shell_command, log it, execute it and return exit code.
+ * stdout/stderr is forwarded to stdout/stderror of calling script
+ * {keyword} quotes and inserts value from assoc array like ET()
+ * {0} .. {n} quotes and inserts positional arguments
+ * {-opts} takes an array and inserts options a la it_html attributes (value, true, false or null)
+ * @param $cmd Format string with {keywords} a la ET()
+ * @param $values (zero, one or more arrays can be passed)
+ * @return exit code of command.
+ */
+static function system(/* $cmd, $values1 = array(), ... */)
+{
+ $args = func_get_args();
+ $cmd = call_user_func_array('it::shell_command', $args);
+
+ $before = microtime(true);
+ if (!EDC('noexec'))
+ system($cmd, $result);
+ else
+ $result = 0;
+
+ @it::log('exec', round((microtime(true) - $before)*1000) . "\t$cmd");
+
+ return $result;
+}
+
+/**
* Construct shell command
* Keywords {keyword} are replace a la ET(), {-opts} takes an array and
* inserts options a la it_html attributes (value, true, false or null)