Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
interp: handle the last exit status code better
In some edge cases, such as commands with no arguments or background commands, we didn't properly reset it to 0. Doing that breaks expansions like "$?"; to properly handle all cases, we need to keep track of the current and last status codes separately, at least while we execute a statement. As a bonus, we can deduplicate a few places where we set r.exit = 0. Fixes #506.
- Loading branch information
Showing
4 changed files
with
10 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters