mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-19 04:58:41 +00:00
add background execution option/flag
This commit is contained in:
parent
1d583a03ea
commit
3e609e6041
|
|
@ -147,17 +147,25 @@ final class SystemUtils
|
|||
return 'localhost.localdomain';
|
||||
}
|
||||
|
||||
public static function runProc(string $executable, string $cmd) : array
|
||||
public static function runProc(string $executable, string $cmd, bool $async = false) : array
|
||||
{
|
||||
if (\strtolower((string) \substr(\PHP_OS, 0, 3)) === 'win') {
|
||||
$cmd = 'cd ' . \escapeshellarg(\dirname($executable))
|
||||
. ' && ' . \basename($executable)
|
||||
. ' '
|
||||
. $cmd;
|
||||
|
||||
if ($async) {
|
||||
$cmd .= ' > nul 2>&1';
|
||||
}
|
||||
} else {
|
||||
$cmd = \escapeshellarg($executable)
|
||||
. ' '
|
||||
. $cmd;
|
||||
|
||||
if ($async) {
|
||||
$cmd .= ' > /dev/null 2>&1';
|
||||
}
|
||||
}
|
||||
|
||||
$pipes = [];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user