Change env string inject order

This commit is contained in:
crazywhalecc 2025-06-09 12:12:22 +08:00
parent 1c1f7b19dd
commit 936c4d8696
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680

View File

@ -45,17 +45,17 @@ class UnixShell
/* @phpstan-ignore-next-line */
logger()->info(ConsoleColor::yellow('[EXEC] ') . ConsoleColor::green($cmd));
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) {
$cmd = 'cd ' . escapeshellarg($this->cd) . ' && ' . $cmd;
}
if (!$this->debug) {
$cmd .= ' 1>/dev/null 2>&1';
}
$env_str = $this->getEnvString();
if (!empty($env_str)) {
$env_str = "{$env_str} ";
}
f_passthru("{$env_str}{$cmd}");
f_passthru($cmd);
return $this;
}