mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-20 15:25:36 +08:00
Change env string inject order
This commit is contained in:
@@ -45,17 +45,17 @@ class UnixShell
|
|||||||
/* @phpstan-ignore-next-line */
|
/* @phpstan-ignore-next-line */
|
||||||
logger()->info(ConsoleColor::yellow('[EXEC] ') . ConsoleColor::green($cmd));
|
logger()->info(ConsoleColor::yellow('[EXEC] ') . ConsoleColor::green($cmd));
|
||||||
logger()->debug('Executed at: ' . debug_backtrace()[0]['file'] . ':' . debug_backtrace()[0]['line']);
|
logger()->debug('Executed at: ' . debug_backtrace()[0]['file'] . ':' . debug_backtrace()[0]['line']);
|
||||||
|
$env_str = $this->getEnvString();
|
||||||
|
if (!empty($env_str)) {
|
||||||
|
$cmd = "{$env_str} {$cmd}";
|
||||||
|
}
|
||||||
if ($this->cd !== null) {
|
if ($this->cd !== null) {
|
||||||
$cmd = 'cd ' . escapeshellarg($this->cd) . ' && ' . $cmd;
|
$cmd = 'cd ' . escapeshellarg($this->cd) . ' && ' . $cmd;
|
||||||
}
|
}
|
||||||
if (!$this->debug) {
|
if (!$this->debug) {
|
||||||
$cmd .= ' 1>/dev/null 2>&1';
|
$cmd .= ' 1>/dev/null 2>&1';
|
||||||
}
|
}
|
||||||
$env_str = $this->getEnvString();
|
f_passthru($cmd);
|
||||||
if (!empty($env_str)) {
|
|
||||||
$env_str = "{$env_str} ";
|
|
||||||
}
|
|
||||||
f_passthru("{$env_str}{$cmd}");
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user