mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-19 00:01:00 +08:00
add bonus exchange downloaded
This commit is contained in:
@@ -55,4 +55,20 @@ class BaseRepository
|
||||
return User::query()->findOrFail(intval($user), $fields);
|
||||
}
|
||||
|
||||
protected function executeCommand($command, $format = 'string'): string|array
|
||||
{
|
||||
$append = " 2>&1";
|
||||
if (!str_ends_with($command, $append)) {
|
||||
$command .= $append;
|
||||
}
|
||||
do_log("command: $command");
|
||||
$result = exec($command, $output, $result_code);
|
||||
$outputString = implode("\n", $output);
|
||||
do_log(sprintf('result_code: %s, result: %s, output: %s', $result_code, $result, $outputString));
|
||||
if ($result_code != 0) {
|
||||
throw new \RuntimeException($outputString);
|
||||
}
|
||||
return $format == 'string' ? $outputString : $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user