Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WCM] Documentation for setProcessPipes() #3303

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions components/process.rst
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,28 @@ When running a program asynchronously, you can send it posix signals with the
POSIX signals are not available on Windows platforms, please refer to the
`PHP documentation`_ for available signals.

Redirecting output to /dev/null
------------------------------

.. versionadded:: 2.5
The :method:`Symfony\\Component\\Process\\Process::setProcessPipes` method was introduced in Symfony 2.4.

Occasionally the output of a process is not important because you are
communicating with it via other means. In these cases it can be helpful
to redirect the output to `/dev/null`` to avoid blocking on full pipes.


.. code-block:: php

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add .. code-block:: php It's a quote now, not a code block

use Symfony\Component\Process\Process;
use Symfony\Component\Process\NullProcessPipes;

$process = new Process('find / -name "rabbit"');
$process->setProcessPipes(new NullProcessPipes());
$process->run();

$process->getOutput(); // Will be empty, but this process will never block on output!

Process Pid
-----------

Expand Down