-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Process] document command-as-arrays #9988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
432973c
to
d05bf61
Compare
d05bf61
to
9a74778
Compare
components/process.rst
Outdated
command-line is parsed by the underlying shell of your operating system. This allows | ||
using e.g. stream redirections or conditional execution, but this is a lot less portable | ||
since each OS (esp. Windows vs Unix-like) deals with escaping and parsing differently. | ||
When passing a command-line string, it becomes your responsibility to deal this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deal with this
80aa41d
to
f9a9eaa
Compare
components/process.rst
Outdated
$process = new Process('echo %MESSAGE%'); | ||
|
||
// On both Unix-like and Windows | ||
$process->run(null, 'MESSAGE' => 'Something to output']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command is missing or what did I miss?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command is echo ...
This line is the ->run()
method call, which is the same for all OS. Only the command definition depends on the OS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, when I read this part it feels like it wants to show me the difference between using a string or an array value which is not the case. That's a bit confusing.
Not sure you understand what I mean. So when I read On both Unix-like and Windows
it sounds to me like the example should tell me how I could make the command run on both systems without dealing with escaping. Oh man, this is hard to explain 😄
components/process.rst
Outdated
Symfony 3.3. | ||
|
||
Defining commands as arrays of arguments is recommended because the Process | ||
component escapes those arguments automatically. Defining commands as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Automatically escaping" does not seem to be the right wording according to your comment in symfony/symfony#27796 (comment) 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reworded :)
21b2bf2
to
7cff554
Compare
7cff554
to
b638c88
Compare
Thank you @nicolas-grekas. |
|
||
$process = new Process(array('/path/command', '--flag', 'arg 1', 'etc.')); | ||
|
||
If you need use stream redirections, conditional execution, or any other |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to use
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, fixed in 2c5579b
* 3.4: Simplified the "Release Process" page [Workflow] Fix typo documentation Fix mismatched list items [symfony#9988] fix minor typos [symfony#10099] update XML and PHP config examples [symfony#9969] fix a minor typo [symfony#10022] fix a minor typo preUpdate Event Listener On Uploaded Imagery [symfony#10124] fix XML attribute name [symfony#10062] fix the code block [PHPUnitBridge] Explain how to show stack traces Fix docs on trusted hosts opcode optimizations
* 4.1: Simplified the "Release Process" page [Workflow] Fix typo documentation Fix mismatched list items typos in sample code [symfony#9988] fix minor typos [symfony#10099] update XML and PHP config examples [symfony#9969] fix a minor typo [symfony#10022] fix a minor typo preUpdate Event Listener On Uploaded Imagery [symfony#9757] fix rst syntax [symfony#10124] fix XML attribute name [symfony#10062] fix the code block [PHPUnitBridge] Explain how to show stack traces Fix docs on trusted hosts opcode optimizations
Fixed #9897