mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-04 23:35:40 +08:00
Enhance error handling in artifact downloading process
This commit is contained in:
@@ -174,6 +174,7 @@ abstract class Shell
|
||||
$process = proc_open($cmd, $descriptors, $pipes, $cwd, env_vars: $env, options: PHP_OS_FAMILY === 'Windows' ? ['create_process_group' => true] : null);
|
||||
|
||||
$output_value = '';
|
||||
$process_completed = false;
|
||||
try {
|
||||
if (!is_resource($process)) {
|
||||
throw new ExecutionException(
|
||||
@@ -251,11 +252,15 @@ abstract class Shell
|
||||
}
|
||||
}
|
||||
|
||||
$process_completed = true;
|
||||
return [
|
||||
'code' => $status['exitcode'],
|
||||
'output' => $output_value,
|
||||
];
|
||||
} finally {
|
||||
if (!$process_completed && is_resource($process)) {
|
||||
proc_terminate($process);
|
||||
}
|
||||
fclose($pipes[1]);
|
||||
fclose($pipes[2]);
|
||||
if ($file_res !== null) {
|
||||
|
||||
Reference in New Issue
Block a user