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

Commit9af2593

Browse files
committed
minor#20681 [Messenger][Process] addfromShellCommandLine() documentation (Staormin)
This PR was merged into the 7.3 branch.Discussion----------[Messenger][Process] add `fromShellCommandLine()` documentationFixes#20655The :method:`Symfony\\Component\\Process\\Messenger\\RunProcessMessage::fromShellCommandline` in my docs point to the 7.1 branch on my local build, any idea how to make it point to 7.3?Commits-------f5164f7 [Messenger][Process] add fromShellCommandLine documentation
2 parents7642705 +f5164f7 commit9af2593

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
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: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2301,8 +2301,9 @@ will take care of creating a new process with the parameters you passed::
23012301

23022302
class CleanUpService
23032303
{
2304-
public function __construct(private readonly MessageBusInterface $bus)
2305-
{
2304+
public function __construct(
2305+
private readonly MessageBusInterface $bus,
2306+
) {
23062307
}
23072308

23082309
public function cleanUp(): void
@@ -2313,6 +2314,34 @@ will take care of creating a new process with the parameters you passed::
23132314
}
23142315
}
23152316

2317+
A static factory:method:`Symfony\\Component\\Process\\Messenger\\RunProcessMessage::fromShellCommandline` is also
2318+
available if you want to use features of your shell such as redirections or pipes::
2319+
2320+
use Symfony\Component\Messenger\MessageBusInterface;
2321+
use Symfony\Component\Process\Messenger\RunProcessMessage;
2322+
2323+
class CleanUpService
2324+
{
2325+
public function __construct(
2326+
private readonly MessageBusInterface $bus,
2327+
) {
2328+
}
2329+
2330+
public function cleanUp(): void
2331+
{
2332+
$this->bus->dispatch(RunProcessMessage::fromShellCommandline('echo "Hello World" > var/log/hello.txt'));
2333+
2334+
// ...
2335+
}
2336+
}
2337+
2338+
For more information, see the
2339+
dedicated:ref:`Using Features From the OS Shell<process-using-features-from-the-os-shell>` documentation.
2340+
2341+
..versionadded::7.3
2342+
2343+
The ``RunProcessMessage::fromShellCommandline()`` method was introduced in Symfony 7.3.
2344+
23162345
Once handled, the handler will return a
23172346
:class:`Symfony\\Component\\Process\\Messenger\\RunProcessContext` which
23182347
contains many useful information such as the exit code or the output of the

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp