mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-20 15:25:36 +08:00
Adjust shell debug log
This commit is contained in:
@@ -41,6 +41,7 @@ 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']);
|
||||||
if ($this->cd !== null) {
|
if ($this->cd !== null) {
|
||||||
$cmd = 'cd ' . escapeshellarg($this->cd) . ' && ' . $cmd;
|
$cmd = 'cd ' . escapeshellarg($this->cd) . ' && ' . $cmd;
|
||||||
}
|
}
|
||||||
@@ -57,8 +58,10 @@ class UnixShell
|
|||||||
/* @phpstan-ignore-next-line */
|
/* @phpstan-ignore-next-line */
|
||||||
logger()->info(ConsoleColor::blue('[EXEC] ') . ConsoleColor::green($cmd));
|
logger()->info(ConsoleColor::blue('[EXEC] ') . ConsoleColor::green($cmd));
|
||||||
} else {
|
} else {
|
||||||
logger()->debug('Running command with result: ' . $cmd);
|
/* @phpstan-ignore-next-line */
|
||||||
|
logger()->debug(ConsoleColor::blue('[EXEC] ') . ConsoleColor::gray($cmd));
|
||||||
}
|
}
|
||||||
|
logger()->debug('Executed at: ' . debug_backtrace()[0]['file'] . ':' . debug_backtrace()[0]['line']);
|
||||||
exec($cmd, $out, $code);
|
exec($cmd, $out, $code);
|
||||||
return [$code, $out];
|
return [$code, $out];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ function f_passthru(string $cmd): ?bool
|
|||||||
if ($danger) {
|
if ($danger) {
|
||||||
logger()->notice('Running dangerous command: ' . $cmd);
|
logger()->notice('Running dangerous command: ' . $cmd);
|
||||||
} else {
|
} else {
|
||||||
logger()->debug('Running command with direct output: ' . $cmd);
|
logger()->debug('[PASSTHRU] ' . $cmd);
|
||||||
}
|
}
|
||||||
$ret = passthru($cmd, $code);
|
$ret = passthru($cmd, $code);
|
||||||
if ($code !== 0) {
|
if ($code !== 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user