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

[Process] fix for Process:isSuccessful() #8801

Closed
wants to merge 1 commit into from
Closed

[Process] fix for Process:isSuccessful() #8801

wants to merge 1 commit into from

Conversation

tgabi333
Copy link
Contributor

Q A
Bug fix? [yes]
New feature? [no]
BC breaks? [no]
Deprecations? [no]
Tests pass? [yes]
Fixed tickets []
License MIT
Doc PR []

If you call isSuccessful() on a running process you would get true because of 0 == null. I think that is not the expected behavior and that is not what phpdoc @return block said so.

This PR fixes another phpunit failure on testCheckTimeoutOnStartedProcess

$this->assertFalse($process->isSuccessful());
usleep(300000);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

In this case I'd rather add a new test case, revealing the bug, instead of modifying an existing one.

@romainneutron
Copy link
Contributor

👍 on adding a new test case. We also must ensure that the exitcode we catch is an int. I suspect that if the comparison was with a simple ==, it's because it may be an int or a string (I really dont know)

@romainneutron
Copy link
Contributor

In case of $this->exitcode === null, I think we should throw a LogicException as a succesful state is neither true nor false before the process finished.

@romainneutron
Copy link
Contributor

last but not least, I think this PR should be open against 2.2

@tgabi333
Copy link
Contributor Author

@tgabi333
Copy link
Contributor Author

New unit test case added. I'm afraid if we throw an exception in isSuccessful() it would be a BC, i would rebase this PR to 2.2 and if you like i would create another PR and put a throw in this method.

@romainneutron
Copy link
Contributor

Be careful, the exitcode might be caught by proc_close or with a hack in case of sigchild enabled environment.

@fabpot, @stof, do you consider throwing a LogicException when calling this method on a running / non-run process a BC break ? Should it be added in 2.2 ? I'd rather consider not, what is your opinion ?

@fabpot
Copy link
Member

fabpot commented Aug 21, 2013

Throwing an exception is a BC break. I think it makes sense to throw an exception on a running / non-run process , but this needs to be done on master instead.

@tgabi333
Copy link
Contributor Author

Replaced with #8815

@tgabi333 tgabi333 closed this Aug 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants