Update exectool.php
This commit is contained in:
parent
c266f2ea45
commit
b859a236a8
|
@ -1,7 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @file exectool.php
|
* @file exectool.php
|
||||||
* @date 2018-07-22
|
* @created_on 2018-07-22
|
||||||
|
* @updated_on 2020-07-10
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <gnh1201@gmail.com>
|
||||||
* @forked from https://github.com/scipag/PHPUtilities
|
* @forked from https://github.com/scipag/PHPUtilities
|
||||||
* @brief ExecTool helper
|
* @brief ExecTool helper
|
||||||
|
@ -133,7 +134,7 @@ if(!is_fn("exec_command")) {
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($method == "") {
|
if (empty($method)) {
|
||||||
// ob_start() will turn on output buffering to collect all output from
|
// 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")
|
// exec_test() and ob_end_clean() will clean the buffer afterwards ("garbage collection")
|
||||||
ob_start();
|
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();
|
ob_start();
|
||||||
|
|
||||||
switch ($method) {
|
switch ($method) {
|
||||||
|
@ -157,7 +163,6 @@ if(!is_fn("exec_command")) {
|
||||||
|
|
||||||
case "exec":
|
case "exec":
|
||||||
exec($command, $output);
|
exec($command, $output);
|
||||||
var_dump($output);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "shell_exec":
|
case "shell_exec":
|
||||||
|
|
Loading…
Reference in New Issue
Block a user