Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix regression involving
command
builtin
Fixes #1402
- Loading branch information
1 parent
9484249
commit d9491d4
Showing
6 changed files
with
67 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,5 +50,5 @@ function _ksh_print_help { | |
/^[^ ]/b | ||
p | ||
}' | | ||
uniq | "$ul" | ||
uniq | "$ul" >&2 | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# | ||
# Verify the `exit` command behaves as expected. | ||
# | ||
|
||
# ======= | ||
actual=$($SHELL -c 'exit' 2>&1) | ||
status=$? | ||
expect=0 | ||
[[ -z $actual ]] || log_error 'bare exit' "" "$actual" | ||
[[ $expect == $status ]] || log_error 'bare exit' "$expect" "$status" | ||
|
||
# ======= | ||
actual=$($SHELL -c 'exit 0' 2>&1) | ||
status=$? | ||
expect=0 | ||
[[ -z $actual ]] || log_error 'exit 0' "" "$actual" | ||
[[ $expect == $status ]] || log_error 'exit 0' "$expect" "$status" | ||
|
||
# ======= | ||
actual=$($SHELL -c 'exit 1' 2>&1) | ||
status=$? | ||
expect=1 | ||
[[ -z $actual ]] || log_error 'exit 1' "" "$actual" | ||
[[ $expect == $status ]] || log_error 'exit 1' "$expect" "$status" | ||
|
||
# ======= | ||
actual=$($SHELL -c 'function e37 { return 37; } ; e37' 2>&1) | ||
status=$? | ||
expect=37 | ||
[[ -z $actual ]] || log_error 'exit 37' "" "$actual" | ||
[[ $expect == $status ]] || log_error 'exit 37' "$expect" "$status" | ||
|
||
# ======= | ||
actual=$($SHELL -c 'exit -1' 2>&1) | ||
status=$? | ||
expect=255 | ||
[[ -z $actual ]] || log_error 'exit -1' "" "$actual" | ||
[[ $expect == $status ]] || log_error 'exit -1' "$expect" "$status" | ||
|
||
# ======= | ||
actual=$($SHELL -c 'exit -2' 2>&1) | ||
status=$? | ||
expect=254 | ||
[[ -z $actual ]] || log_error 'exit -2' "" "$actual" | ||
[[ $expect == $status ]] || log_error 'exit -2' "$expect" "$status" | ||
|
||
# ======= | ||
$SHELL +E -i <<- \! && log_error 'interactive shell should not exit 0 after false' | ||
false | ||
exit | ||
! | ||
status=$? | ||
expect=1 | ||
[[ $expect == $status ]] || log_error 'bare exit after false' "$expect" "$status" |
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