Skip to content

Commit

Permalink
Remove ANY_NIX_SHELL_EXIT_STATUS
Browse files Browse the repository at this point in the history
The exit status was inaccurate in some cases. For example, stopping
the `nix-shell` via `ctrl`+`Z` was interpreted as exiting.

There seems to be no non-buggy way to implement this feature, so we
remove it.
  • Loading branch information
haslersn committed Dec 17, 2018
1 parent 8aa4ae9 commit 9d7d6fd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
8 changes: 1 addition & 7 deletions bin/any-nix-shell
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ function init_fish () {
# Overwrite the nix-shell command
function nix-shell
$(which .any-nix-shell-wrapper) fish \$argv
set -gx ANY_NIX_SHELL_EXIT_STATUS \$status
end
# Overwrite the nix command
function nix
if test \$argv[1] = run
set argv[1] fish
$(which .any-nix-run-wrapper) \$argv
set -gx ANY_NIX_SHELL_EXIT_STATUS \$status
else
command nix \$argv
end
Expand All @@ -33,7 +31,6 @@ EOF
function fish_right_prompt
$(which nix-shell-info)
printf " "
set -e ANY_NIX_SHELL_EXIT_STATUS
end
EOF
);;
Expand All @@ -50,15 +47,13 @@ function init_zsh () {
# Overwrite the nix-shell command
function nix-shell () {
$(which .any-nix-shell-wrapper) zsh "\$@"
export ANY_NIX_SHELL_EXIT_STATUS=\$status
}
# Overwrite the nix command
function nix () {
if [[ \$1 == run ]]; then
shift
$(which .any-nix-run-wrapper) zsh "\$@"
export ANY_NIX_SHELL_EXIT_STATUS=\$status
else
command nix "\$@"
fi
Expand All @@ -76,7 +71,6 @@ precmd () {
with_codes=\$($(which nix-shell-info))
without_codes=\$(printf "\$with_codes" | sed -r "s/\\\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g")
RPROMPT=%\${#without_codes}{\$with_codes%}
unset ANY_NIX_SHELL_EXIT_STATUS
}
EOF
Expand All @@ -102,4 +96,4 @@ case "$1" in
*) error;;
esac

echo "$output"
echo "$output"
6 changes: 0 additions & 6 deletions bin/nix-shell-info
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,4 @@ if [[ $IN_NIX_SHELL != "" ]] || [[ $IN_NIX_RUN != "" ]]; then
printf "[unknown environment]"
fi
printf "\033[0m"
elif [[ $ANY_NIX_SHELL_EXIT_STATUS ]]; then
if [[ $ANY_NIX_SHELL_EXIT_STATUS == 0 ]]; then
printf "\033[1;36mexited environment\033[0m"
else
printf "\033[1;31mERROR\033[0m"
fi
fi

0 comments on commit 9d7d6fd

Please sign in to comment.