-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Process][Tests] Prove process fail #5575
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
Conversation
BTW, this test fails on PHP 5.3.15 |
This is actually normal because There's a workaround for your problem : $process = new Process("bash -c 'echo -n 1 ; echo -n 1'");
$process->run();
var_dump('11' == $process->getOutput()); // true, |
another solution is to run it as a single process: |
I added more tests case , and it always fail. I found this bug in Sismo repo https://github.com/fabpot/Sismo/blob/master/tests/Sismo/Tests/GithubProjectTest.php#L51 : When I lunch the test suite, Sismo tests fails because Note: 86d9dea is tested on debian 6 and php 5.3.15
|
This s still actually normal, @stof example is wrong as it's the same of your example, there is still two commands You have to wrap it inside a bash script to get your expected result |
@romainneutron But, how can sismo test pass ? It is impossible that @fabpot push failed tests ! ;) |
@romainneutron is it really 2 processes when using |
BTW, my sample is not related to $process = new Process("git status && git status"); have the same problem. |
It's pretty weird, this PR is related to exceptions. Are you sure you're pointing the right one ? @stof If you run |
@lyrixx BTW I'm sure that if you encapsulate your commands with |
@lyrixx I don't understand how it is possible. The PR is not changing the logic at all. It is simply using a subclass for exception it throws |
Oh, sorry, i pointed a wrong PR, the changeless happend in 7bafc69 ; Related PR : #5543 @romainneutron I agree with you about |
Ok, the change appeared because we now preprend commands with This change is quite important and necessary because it allows us to get the exact Pid of the process, signal it and have more control over it. If we remove it , the process will be wrapped by a I do think we have to mention it in the doc and docblocks, I'll work on it |
@romainneutron but without the wrapping in |
@stof which cases ? such one : |
@romainneutron yes. And I can tell you that such cases are used in many places in Composer for instance. |
So, this is an issue |
@fabpot should we revert the prepending of |
Right now, I don't have any quick fix except revert. But revert will drop many features |
we should probably revert for 2.1 and work on it on 2.2 |
And, if we wrap exec with parenthesis ? $this->commandline = 'exec (' . $this->commandline . ')'; EDIT : does not work |
@romainneutron drop many features ? It will not drop features comparing to the state in 2.0 but reintroduce the BC. |
Auto-answer : It does not work. |
okay, you are correct. The only features I'm wondering that might have a substancial change is ones that use |
As proc_terminate will send signal on the |
@stof What do you think about this PR, Should it be merged ? If yes, into master, 2.1, 2.0 ? |
OK, So i sould close this PR right now, and open it again against 2.1 branch ? |
yup, and reference this PR in your new one |
Commits ------- 27b2df9 [Process] Fixed bug introduced by 7bafc69. 7a955c0 [Process][Tests] Prove process fail (Add more test case) 598dcf3 [Process][Tests] Prove process fail Discussion ---------- [Process][Tests] Prove process fail with chained commands Bug fix: no Feature addition: no Backwards compatibility break: no Symfony2 tests pass: no Fixes the following tickets: - Todo: Fix that License of the code: MIT This PR is against 2.1 branch. Previous PR was #5575 This PR try to hiligh a regression in Process component. ``` php $process = new Process("echo -n 1 && echo -n 1"); // or $process = new Process("echo -n 1 ; echo -n 1"); $process->run(); var_dump('11' == $process->getOutput()); // false, var_dump($process->getOutput()); // '1', ``` This test failed because of PR #5543 ; see 7bafc69#L0R233 --------------------------------------------------------------------------- by romainneutron at 2012-09-25T13:05:45Z You've to revert the change that causes the fail (ie: remove https://github.com/symfony/symfony/blob/2.1/src/Symfony/Component/Process/Process.php#L233) --------------------------------------------------------------------------- by romainneutron at 2012-09-25T13:06:56Z BTW, removing this line re-open #5030 --------------------------------------------------------------------------- by stof at 2012-09-25T13:11:15Z @lyrixx please add a commit reverting the addition of ``exec`` in the case of sigchild not being used (only this addition, not the full commit you linked) as it should fix your test. --------------------------------------------------------------------------- by stof at 2012-09-25T13:12:21Z @fabpot btw, this regression is quite important. As I said in the previous PR, it impacts composer in a bunch of places. --------------------------------------------------------------------------- by romainneutron at 2012-09-25T13:30:07Z You reverted too much things, you just had to remove line 233 --------------------------------------------------------------------------- by stof at 2012-09-25T13:42:49Z @lyrixx I explicitly asked you to revert only the ``exec`` addition for the case without sigchild. --------------------------------------------------------------------------- by lyrixx at 2012-09-25T13:55:57Z @stof Sorry, i fixed that. --------------------------------------------------------------------------- by romainneutron at 2012-09-25T13:56:26Z @lyrixx just remove the two last commit, edit Process.php and remove line 233 --------------------------------------------------------------------------- by lyrixx at 2012-09-25T13:59:59Z @romainneutron I think it's ok now. --------------------------------------------------------------------------- by romainneutron at 2012-09-25T14:11:28Z yep it's good :)
Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: no
Fixes the following tickets: -
Todo: Fix that
License of the code: MIT
I am not sure this is an issue, but the following code does not work :
I don't know why.
tests are run on php 5.4.7 and ubuntu 11.04