execute
Definition
execute($cmd, $fail_msg, $fail_status = STA_FAIL, $terminate_on_fail = TRUE)
test_it.php, line 188
Description
Executes command
Parameters
$cmd command to execute
$fail_msg msg to be displayed on fail
$fail_status which is returned
$terminate_on_fail if true execute will terminate testing, if false it will return exec output
Code
<?php
function execute($cmd, $fail_msg, $fail_status = STA_FAIL, $terminate_on_fail = TRUE) {
global $executed_commands, $msg, $debug;
$return = '';
$executed_commands[] = $cmd;
exec($cmd, $output, $status);
watchdog('test_it', $cmd . ' ' . $status . '-out-' . serialize($output));
if ($status && $terminate_on_fail) {
return terminateTesting($fail_status, "<strong>" . $fail_msg . "<br>" . implode($output, "<br>") . "</strong>");
}
else if (!$terminate_on_fail) {
$return = $output;
}
if ($debug) {
$exec_msg = "<br>Command: " . $cmd ."<br> Result:<br>";
$exec_msg .= "<strong>" . implode($output, "<br>") . "</strong>";
$msg .= $exec_msg;
}
return $return;
}
?> 