|
@@ -6,6 +6,7 @@ use OldSound\RabbitMqBundle\RabbitMq\ConsumerInterface;
|
|
|
use PhpAmqpLib\Message\AMQPMessage;
|
|
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
|
use Symfony\Component\Process\Process;
|
|
|
+use Symfony\Component\Process\Exception\ProcessFailedException;
|
|
|
|
|
|
class CommandConsumer implements ConsumerInterface
|
|
|
{
|
|
@@ -54,12 +55,20 @@ class CommandConsumer implements ConsumerInterface
|
|
|
|
|
|
$consolePath = $this->serviceContainer->get('kernel')->getRootDir() . '/../bin/console';
|
|
|
$command = $name . ' ' . implode(' ', $input);
|
|
|
- $process = new Process("{$consolePath} {$command}");
|
|
|
- $process->setTimeout(0);
|
|
|
- $process->run();
|
|
|
- $content = $process->getOutput();
|
|
|
- echo $content;
|
|
|
-
|
|
|
+
|
|
|
+ try {
|
|
|
+ $process = new Process("{$consolePath} {$command}");
|
|
|
+ $process->setTimeout(10 * 60);
|
|
|
+ $process->run();
|
|
|
+
|
|
|
+ $content = $process->getOutput();
|
|
|
+ echo $content;
|
|
|
+ } catch (ProcessFailedException $e) {
|
|
|
+ echo 'KILL COMMAND: ', $e->getMessage(), "\n";
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ echo 'KILL COMMAND: ', $e->getMessage(), "\n";
|
|
|
+ }
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|