Skip to content

Commit fe6c301

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

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

components/process.rst

Lines 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)