Skip to content

Commit 8bfc23a

Browse files
committed
fix: prevent symfony treating spaced arguments as the console command name
1 parent c727ead commit 8bfc23a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Job/ConsoleCommandJob.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,18 @@ public function run(ParameterBagInterface $parameterBag): string
2323
$command = [];
2424

2525
$command[] = $this->getConsolePath($parameterBag->get('markup_job_queue.console_dir'));
26-
$command[] = $this->args['command'];
26+
27+
/**
28+
* This is less than ideal, but trying to support legacy and v3 and v4 symfony
29+
*/
30+
// If the command has been provided like `do:something "hello"` allow it through
31+
if (stripos($this->args['command'], '"') !== false) {
32+
$command[] = $this->args['command'];
33+
} else {
34+
// If the command has been provided like `do:something hello` split so the escaping is correct
35+
$command = array_merge($command, explode(' ', $this->args['command']));
36+
}
37+
2738

2839
$uuid = isset($this->args['uuid']) ? $this->args['uuid']: null;
2940
if($uuid) {
@@ -52,7 +63,7 @@ public function run(ParameterBagInterface $parameterBag): string
5263
if (!$process->isSuccessful()) {
5364
$message = sprintf(
5465
'A job `%s` failed with topic `%s` with output:%s and the error output: %s',
55-
$command,
66+
$this->args['command'],
5667
$this->topic,
5768
$process->getOutput(),
5869
$process->getErrorOutput()

0 commit comments

Comments
 (0)