Skip to content

[Process] Fix pipes handling #18066

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

Merged
merged 1 commit into from
Mar 10, 2016
Merged

[Process] Fix pipes handling #18066

merged 1 commit into from
Mar 10, 2016

Conversation

nicolas-grekas
Copy link
Member

Q A
Branch 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #18015
License MIT
Doc PR -

@nicolas-grekas
Copy link
Member Author

Status: needs work

@nicolas-grekas
Copy link
Member Author

GREEN!
Status: needs review
This PR fixes current failures on 2.7 and allows unskipping previously failing tests on Windows.
Ping @romainneutron

if (is_resource($input)) {
$this->input = $input;
} elseif (is_string($input)) {
$this->inputBuffer = $input;
Copy link
Member Author

Choose a reason for hiding this comment

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

If the string already fits in memory, there is no gain in putting it in a php://temp stream

}
// Remove extra null chars returned by fread
if ('' !== $data) {
$read[$type] = rtrim($data, "\x00");
Copy link
Member Author

Choose a reason for hiding this comment

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

@romainneutron I can't reproduce trailing nul chars so I removed this. Can you?

Copy link
Contributor

Choose a reason for hiding this comment

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

This may happen e.g. if you decrypt a string using mcrypt_decrypt.

@xabbuh
Copy link
Member

xabbuh commented Mar 10, 2016

Amazing work @nicolas-grekas. I almost got mad when trying to fix this build failure. The change itself looks good but I am not too familiar with how the different systems handle processes.

$w = array($this->pipes[0]);

// let's have a look if something changed in streams
if (false === $n = @stream_select($r, $w, $e, 0, 0)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

no need to wait here as this is done in readAndWrite

@fabpot
Copy link
Member

fabpot commented Mar 10, 2016

Thank you @nicolas-grekas.

@fabpot fabpot merged commit 3ab6c39 into symfony:2.7 Mar 10, 2016
fabpot added a commit that referenced this pull request Mar 10, 2016
This PR was merged into the 2.7 branch.

Discussion
----------

[Process] Fix pipes handling

| Q             | A
| ------------- | ---
| Branch        | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #18015
| License       | MIT
| Doc PR        | -

Commits
-------

3ab6c39 [Process] Fix pipes handling
@nicolas-grekas nicolas-grekas deleted the fix-proc branch March 10, 2016 10:09
This was referenced Mar 25, 2016
This was referenced Mar 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants