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

Only fail subcommands when they exit non-zero. #53

Merged
merged 1 commit into from Mar 5, 2015
Merged

Conversation

markstory
Copy link
Member

Instead of looking in stderr, the exit code of a process should be used to determine whether or not it worked.

Refs #51

Instead of looking in stderr, the exit code of a process should be used
to determine whether or not it worked.

Refs #51
@markstory markstory added this to the 1.0.0 milestone Mar 5, 2015
lorenzo added a commit that referenced this pull request Mar 5, 2015
Only fail subcommands when they exit non-zero.
@lorenzo lorenzo merged commit e24eddb into master Mar 5, 2015
@lorenzo lorenzo deleted the issue-51 branch March 5, 2015 06:42

if ($error) {
if ($exit != 0) {
Copy link
Member

Choose a reason for hiding this comment

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

Does this need to be a strict check?

Copy link
Member

Choose a reason for hiding this comment

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

Can be less strict i.e. if ($exit) {

Copy link
Member

Choose a reason for hiding this comment

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

I am thinking about false positives when returning a string like "foobar", which would then be false (unexpected) with != 0, while true (expected) with strict checks.

Copy link
Member

Choose a reason for hiding this comment

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

The return value of proc_close is an int.

Copy link
Member

Choose a reason for hiding this comment

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

Right, so the strict check would be best regarding the guideline "be as as strict as possible".

Copy link
Member

Choose a reason for hiding this comment

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

well, it's academic really. We know it's a number and to me this is clearer:

if ($exit) {

instead of:

if ($exit !== 0) {

For me that involves mental shuffling whereas "if exit go here" does not.

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