diff --git a/helper/exectool.php b/helper/exectool.php index 68a9f33..6d0f415 100644 --- a/helper/exectool.php +++ b/helper/exectool.php @@ -1,7 +1,8 @@ * @forked from https://github.com/scipag/PHPUtilities * @brief ExecTool helper @@ -133,7 +134,7 @@ if(!is_fn("exec_command")) { return $return; } - if ($method == "") { + if (empty($method)) { // ob_start() will turn on output buffering to collect all output from // exec_test() and ob_end_clean() will clean the buffer afterwards ("garbage collection") ob_start(); @@ -148,6 +149,11 @@ if(!is_fn("exec_command")) { } } + // An 'async' option will be return PID + if(array_key_equals("async", $options, true)) { + $command = sprintf("%s 1>/dev/null 2>&1 & echo $!;", $command); + } + ob_start(); switch ($method) { @@ -157,7 +163,6 @@ if(!is_fn("exec_command")) { case "exec": exec($command, $output); - var_dump($output); break; case "shell_exec":