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

Add support for additional file descriptors #12

Closed
vektah opened this issue Mar 6, 2015 · 0 comments · Fixed by #65
Closed

Add support for additional file descriptors #12

vektah opened this issue Mar 6, 2015 · 0 comments · Fixed by #65

Comments

@vektah
Copy link

vektah commented Mar 6, 2015

In writing https://github.com/Vektah/phpunit-parallel I wanted to set up an additional pipe between the parent and child processes, but it seems there is currently no good way to do this.

We could add it to the constructor, but the constructor already has a bunch of arguments:

/**
    * Constructor.
    *
    * @param string $cmd     Command line to run
    * @param string $cwd     Current working directory or null to inherit
    * @param array  $env     Environment variables or null to inherit
    * @param array  $options Options for proc_open()
    * @throws RuntimeException When proc_open() is not installed
    */
    public function __construct($cmd, $cwd = null, array $env = null, array $options = array())

It really shouldn't be mutable state though otherwise cleanup could be broken and file descriptors could start leaking.

I'm happy to throw a PR up but I want to get some thoughts first.

Block of code in question:

        $fdSpec = array(
            array('pipe', 'r'), // stdin
            array('pipe', 'w'), // stdout
            array('pipe', 'w'), // stderr
            // I want to add additional pipes here. 
        );

enhanced sigchild support will also need to move down the appropriate number of file descriptors when new descriptors are added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants