Open hosein-xz opened 3 years ago
@barryvdh accept this pr, please because it has right.
I think this solution works. But I do not know why. I met the same problem. I am using Laravel 6.x, and Symfony/process 4.4.x. When I used laravel-async-queue 0.7.4 or before, it worked well. When I upgrade it to 0.7.5, it does not work.
I debugged it step by step, the reason is if we put command into an array, Symfony/process::escapeArgument will run. https://github.com/symfony/process/blob/5cee9cdc4f7805e2699d9fd66991a0e6df8252a2/Process.php#L1625
It is used in Symfony/process:start() https://github.com/symfony/process/blob/5cee9cdc4f7805e2699d9fd66991a0e6df8252a2/Process.php#L313
Let's assume symfony/process is correct. Sorry that I am not a good programmer.
I do not know why symfony/process will replace single quote('
) with a symber string ('\\''
).
Before the command is put into an array, in my case, it is:
'php' artisan queue:async 25 async > /dev/null 2>&1 &
------------ It works well in a terminal
After it is put into an array, and it will be called in process:escapeArgument(), then it become:
'\\''php'\\'' artisan queue async 25 async > /dev/null 2>&1 &
---------------- It does not work in a terminal
Anyway, in my case, I won't put the command into an array for symfony/process.
Symfony Process Does not accept array before Laravel 7 So The app version should be checked