[Process] document command-as-arrays#9988
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. |
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.
The command is missing or what did I miss?
There was a problem hiding this comment.
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.
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.
"Automatically escaping" does not seem to be the right wording according to your comment in symfony/symfony#27796 (comment) 😄
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 |
* 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