Skip to content

Commit 36ba5c3

Browse files
committed
[BUGFIX] handle Process RuntimeException
1 parent 97508db commit 36ba5c3

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Classes/Domain/Service/ProcessRunner.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use B13\ContentSync\Exception;
1818
use Psr\EventDispatcher\EventDispatcherInterface;
1919
use Psr\Log\LoggerInterface;
20+
use Symfony\Component\Process\Exception\RuntimeException;
2021
use Symfony\Component\Process\Process;
2122

2223
final readonly class ProcessRunner
@@ -83,7 +84,11 @@ private function exec(string $cmd, int $timeout): void
8384
{
8485
$this->logger->debug($cmd);
8586
$process = Process::fromShellCommandline(command: $cmd, timeout: $timeout);
86-
$process->run();
87+
try {
88+
$process->run();
89+
} catch (RuntimeException $e) {
90+
throw new Exception('process runtime exception: ' . $e->getMessage() . ' - ' . $e->getCode(), 1780919317);
91+
}
8792
if (!$process->isSuccessful()) {
8893
throw new Exception('cannot exec command ' . $cmd . ' with error ' . $process->getErrorOutput(), 1600757440);
8994
}

0 commit comments

Comments
 (0)