-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Description
| Q | A |
|---|---|
| Bug report? | no |
| Feature request? | yes |
| BC Break report? | no |
| RFC? | yes |
| Symfony version | 3.4 |
With 3.3, we already support "prepared" command lines.
$process = new Process('echo $abc && echo $def');
$process->inheritEnvironmentVariables(); // unrelated, just for FC
$process->run(null, array('abc' => 'ABC', 'def' => 'DEF'); // echoes ABCDEFIt works quite simply: it just creates the corresponding env vars and leverages the underlying shell to parse the command line and use the values. The $abc syntax comes from sh of course, nothing we have to deal with fortunately.
BUT this comes with a drawback, namely: portability. Why? Because we rely on the shell to parse the command line :)
On Windows, the same command has to be written as echo !abc! && echo !def!, using the !foo! syntax from Windows' shell (cmd.com) to use env vars.
While creating a portable command line language is out of scope, we could at least provide some portable syntax for env vars injection.
One proposal as already been made, using curly brackets: echo {abc} && echo {def}.
WDYT?