Skip to content

Commit

Permalink
refactor: ensure $? can report failure
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Larson <[email protected]>
  • Loading branch information
LucasLarson committed Aug 11, 2024
1 parent 8fd01e4 commit 7b1278a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions custom/aliases.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ define() {
command -v -- hash >/dev/null 2>&1 &&
printf -- 'hash return value:\n%d\n———\n' "$(
hash "${query-}" >/dev/null 2>&1
printf -- '%d\n' "$?"
printf -- '%d\n' "${?:-1}"
)"

# `type` (System V; POSIX)
Expand Down Expand Up @@ -1816,7 +1816,7 @@ command -v -- python3 >/dev/null 2>&1 &&

# $?
question_mark() {
printf -- '%d\n' "$?"
printf -- '%d\n' "${?:-1}"
}
alias '?'='question_mark'

Expand Down

0 comments on commit 7b1278a

Please sign in to comment.