8000 [Process][FR] Add an option to redirect any output to /dev/null · Issue #9007 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
8000

[Process][FR] Add an option to redirect any output to /dev/null #9007

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

Closed
romainneutron opened this issue Sep 12, 2013 · 3 comments
Closed

[Process][FR] Add an option to redirect any output to /dev/null #9007

romainneutron opened this issue Sep 12, 2013 · 3 comments

Comments

@romainneutron
Copy link
Contributor

As well as it could be nice to flush the output, discarding it could be nice in term of memory consumption for long process where output is not needed.

In terms of proc_open descriptors, it consists in :

$nullfile = defined('PHP_WINDOWS_VERSION_BUILD') ? 'NUL' : '/dev/null';
$descriptors = array(
    1 => array("file", $nullfile, "a+"),
    2 => array("file", $nullfile, "a+"),
);
@cordoval
Copy link
Contributor
cordoval commented Dec 7, 2013

why NUL and not NULL? is windows that crazy?

@romainneutron
Copy link
Contributor Author

yes it is ;)

@romainneutron
Copy link
Contributor Author

vektah pushed a commit to vektah/symfony that referenced this issue Dec 9, 2013
Currently processes that output large amounts of data will block. If
the output is not important then this becomes an issue. It can be worked
around by redirecting the output to > /dev/null but this requires an
instance of /bin/sh to do the work.

This patch adds the ability to set the processPipes, and a new
processPipe that redirects to /dev/null.

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony#9007
| License       | MIT
| Doc PR        | symfony/symfony-docs#3303
fabpot added a commit that referenced this issue Mar 12, 2014
…leOutput methods (romainneutron)

This PR was merged into the 2.5-dev branch.

Discussion
----------

[Process] Add Process::disableOutput and Process::enableOutput methods

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #9007
| License       | MIT
| Doc PR        | symfony/symfony-docs#3664

This is another implementation for #9007 that allows to disable the output/error-output storage in a Process in order to avoid using memory.
This is particularly useful when the process outputs large data and it's not read.

Commits
-------

a891e14 [Process] Add Process::disableOutput and Process::enableOutput methods
@fabpot fabpot closed this as completed Mar 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0