Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fe6c301

Browse filesBrowse files
committed
Merge branch '4.4'
* 4.4: Tweaks #11802 [Process] allow writing "prepared" command line.
2 parents b18e3c3 + 531e1d0 commit fe6c301
Copy full SHA for fe6c301

File tree

1 file changed

+21
-0
lines changed
Filter options

1 file changed

+21
-0
lines changed

‎components/process.rst

Copy file name to clipboardExpand all lines: components/process.rst
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,27 @@ instead::
350350
);
351351
$process->run();
352352

353+
Using a Prepared Command Line
354+
-----------------------------
355+
356+
You can run the process by using a a prepared command line using the
357+
double bracket notation. You can use a placeholder in order to have a
358+
process that can only be changed with the values and without changing
359+
the PHP code::
360+
361+
use Symfony\Component\Process\Process;
362+
363+
$process = Process::fromShellCommandline('echo "$name"');
364+
$process->run(null, ['name' => 'Elsa']);
365+
366+
.. caution::
367+
368+
A prepared command line will not be escaped automatically!
369+
370+
.. versionadded:: 4.4
371+
372+
Prepared command lines were introduced in Symfony 4.4.
373+
353374
Process Timeout
354375
---------------
355376

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.