Skip to content

symfony/process - Blocked fileHandles before proc_close on Windows #8836

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
maryo opened this issue Aug 23, 2013 · 3 comments
Closed

symfony/process - Blocked fileHandles before proc_close on Windows #8836

maryo opened this issue Aug 23, 2013 · 3 comments
Labels

Comments

@maryo
Copy link
Contributor

maryo commented Aug 23, 2013

I am using symfony and symfony/assetic-bundle 2.3.x-dev, Windows 7 (64b).

    //Fix for PHP bug #51800: reading from STDOUT pipe hangs forever on Windows if the output is too big.
    //Workaround for this problem is to use temporary files instead of pipes on Windows platform.

It looks like those file handles are not readable unless the process is closed. The fread function returns an empty string in the case it's not readable.

I've fixed it using this dirty hotfix which works for my scenario.

http://maryo.cz/files/hotfix.png

@fabpot
Copy link
Member

fabpot commented Aug 23, 2013

ping @romainneutron

@romainneutron
Copy link
Contributor

seems related to #8799

fabpot added a commit that referenced this issue Sep 7, 2013
This PR was squashed before being merged into the 2.2 branch (closes #8924).

Discussion
----------

[Process][2.2] Fix Process component on windows

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #8836, #8799, #7078
| License       | MIT

This PR fixes Process on windows (almost, see note below).
 - Some unit tests were not Windows compatible
 - Use a file handle for STDERR as well as STDOUT to avoid blocking
 - Decouple pipes and descriptors from Process

As this move some a part of Process in a sub class, I hope merging this in 2.3 and master would not be a PITA. I'm here to make some adjustments after theses merge if needed.

**Important note** :

We are using file handles instead of streams for `proc_open` pipes as described in the code (see [PHP bug #51800](https://bugs.php.net/bug.php?id=51800)). Unfortunately, this workaround may produce corrupted output/error output in some race conditions. That's why `AbstractProcessTest::testProcessPipes` randomly fails when using file handles (on unix and windows).

Commits
-------

4a76c76 [Process][2.2] Fix Process component on windows
@fabpot fabpot closed this as completed Sep 7, 2013
@romainneutron
Copy link
Contributor

Let's check the issue is solved once #8955 is merged

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

No branches or pull requests

3 participants