@@ -281,6 +281,34 @@ You can access the `pid`_ of a running process with the
281
281
you may have to prefix your commands with `exec `_. Please read
282
282
`Symfony Issue#5759 `_ to understand why this is happening.
283
283
284
+ Disabling Output
285
+ ----------------
286
+
287
+ .. versionadded :: 2.5
288
+ The :method: `Symfony\\ Component\\ Process\\ Process::disableOutput ` and
289
+ :method: `Symfony\\ Component\\ Process\\ Process::enableOutput ` methods were
290
+ introduced in Symfony 2.5.
291
+
292
+ As standard output and error output are always fetched from the underlying process,
293
+ it might be convenient to disable output in some cases to save memory.
294
+ Use :method: `Symfony\\ Component\\ Process\\ Process::disableOutput ` and
295
+ :method: `Symfony\\ Component\\ Process\\ Process::enableOutput ` to toggle this feature::
296
+
297
+ use Symfony\Component\Process\Process;
298
+
299
+ $process = new Process('/usr/bin/php worker.php');
300
+ $process->disableOutput();
301
+ $process->run();
302
+
303
+ .. caution ::
304
+
305
+ You can not enable or disable the output while the process is running.
306
+
307
+ If you disable the output, you cannot access ``getOutput ``,
308
+ ``getIncrementalOutput ``, ``getErrorOutput `` or ``getIncrementalErrorOutput ``.
309
+ Moreover, you could not pass a callback to the ``start ``, ``run `` or ``mustRun ``
310
+ methods or use ``setIdleTimeout ``.
311
+
284
312
.. _`Symfony Issue#5759` : https://github.com/symfony/symfony/issues/5759
285
313
.. _`PHP Bug#39992` : https://bugs.php.net/bug.php?id=39992
286
314
.. _`exec` : http://en.wikipedia.org/wiki/Exec_(operating_system)
0 commit comments