Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit7020d3e

Browse files
committed
[Messenger][Process] add fromShellCommandLine documentation
1 parent903614c commit7020d3e

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

‎components/process.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ You can configure the options passed to the ``other_options`` argument of
114114
and ``suppress_errors``) are only supported on Windows operating systems.
115115
Check out the `PHP documentation for proc_open()`_ before using them.
116116

117+
.. _process-using-features-from-the-os-shell:
118+
117119
Using Features From the OS Shell
118120
--------------------------------
119121

‎messenger.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2265,6 +2265,31 @@ will take care of creating a new process with the parameters you passed::
22652265
}
22662266
}
22672267

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+
22682293
Once handled, the handler will return a
22692294
:class:`Symfony\\Component\\Process\\Messenger\\RunProcessContext` which
22702295
contains many useful information such as the exit code or the output of the

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp