Skip to content
This repository was archived by the owner on Mar 9, 2024. It is now read-only.

Check app version before passing [command] to Process #97

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Check app version before passing [command] to Process #97

wants to merge 1 commit into from

Conversation

hosein-xz
Copy link

Symfony Process Does not accept array before Laravel 7 So The app version should be checked

Symfony Process Does not accept array before Laravel 7 So The app version should be checked
@oriceon
Copy link
Contributor

oriceon commented Feb 11, 2022

@barryvdh accept this pr, please because it has right.

@dahoohurst
Copy link

dahoohurst commented Sep 20, 2022

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants