-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
- Loading branch information
There are no files selected for viewing
3 comments
on commit a4cfc46
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The proper code to ensure 0 or 1 is
execute() == 0 and 0 or 1
because execute
returns only integers such that execute(...) and 0 or 1
never returns 1.
Why is the 0|1 return code necessary here but not for others
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes the fact that the existing code didn't work as intended is another issue.
Question is whether we should fix the bug while preserving the original intention or as you suggest here to drop it completely
As you say, other functions expose the os.execute return value .
I don't know if @josephwright remembers why these functions had the ... or 1 added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have places where we get a return value of 256 from some successful processes, and those need to be coerced to give 0 - I don't remember if this is one but we do need to watch out for that.
I believe the intention here was to ensure that only 0 or 1 is returmed rather than rely on system-dependent error codes