mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-10 22:18:40 +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';
|
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') {
|
if (\strtolower((string) \substr(\PHP_OS, 0, 3)) === 'win') {
|
||||||
$cmd = 'cd ' . \escapeshellarg(\dirname($executable))
|
$cmd = 'cd ' . \escapeshellarg(\dirname($executable))
|
||||||
. ' && ' . \basename($executable)
|
. ' && ' . \basename($executable)
|
||||||
. ' '
|
. ' '
|
||||||
. $cmd;
|
. $cmd;
|
||||||
|
|
||||||
|
if ($async) {
|
||||||
|
$cmd .= ' > nul 2>&1';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$cmd = \escapeshellarg($executable)
|
$cmd = \escapeshellarg($executable)
|
||||||
. ' '
|
. ' '
|
||||||
. $cmd;
|
. $cmd;
|
||||||
|
|
||||||
|
if ($async) {
|
||||||
|
$cmd .= ' > /dev/null 2>&1';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$pipes = [];
|
$pipes = [];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user