File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,8 @@ You can configure the options passed to the ``other_options`` argument of
114
114
and ``suppress_errors ``) are only supported on Windows operating systems.
115
115
Check out the `PHP documentation for proc_open() `_ before using them.
116
116
117
+ .. _process-using-features-from-the-os-shell :
118
+
117
119
Using Features From the OS Shell
118
120
--------------------------------
119
121
Original file line number Diff line number Diff line change @@ -2265,6 +2265,31 @@ will take care of creating a new process with the parameters you passed::
2265
2265
}
2266
2266
}
2267
2267
2268
+ A static factory :method: `Symfony\\ Component\\ Process\\ Messenger\\ RunProcessMessage::fromShellCommandline ` is also
2269
+ available if you want to use features of your shell such as redirections or pipes. For more information, see the
2270
+ dedicated :ref: `Using Features From the OS Shell <process-using-features-from-the-os-shell >` documentation. ::
2271
+
2272
+ use Symfony\Component\Messenger\MessageBusInterface;
2273
+ use Symfony\Component\Process\Messenger\RunProcessMessage;
2274
+
2275
+ class CleanUpService
2276
+ {
2277
+ public function __construct(private readonly MessageBusInterface $bus)
2278
+ {
2279
+ }
2280
+
2281
+ public function cleanUp(): void
2282
+ {
2283
+ $this->bus->dispatch(RunProcessMessage::fromShellCommandline('echo "Hello World" > var/log/hello.txt'));
2284
+
2285
+ // ...
2286
+ }
2287
+ }
2288
+
2289
+ .. versionadded :: 7.3
2290
+
2291
+ The ``RunProcessMessage::fromShellCommandline() `` method was introduced in Symfony 7.3.
2292
+
2268
2293
Once handled, the handler will return a
2269
2294
:class: `Symfony\\ Component\\ Process\\ Messenger\\ RunProcessContext ` which
2270
2295
contains many useful information such as the exit code or the output of the
You can’t perform that action at this time.
0 commit comments