Skip to content

Commit fb5da26

Browse files
committed
Fixed fish_prompt not displaying $status
The virtualenv `fish_prompt` wrapper now ensures that the original `fish_prompt` correctly displays the `$status` of the last command.
1 parent be8eeb0 commit fb5da26

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

virtualenv_embedded/activate.fish

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,19 @@ if test \( -z $VIRTUAL_ENV_DISABLE_PROMPT \)
5050
functions -c fish_prompt _old_fish_prompt
5151

5252
function fish_prompt
53+
# Save the current $status, for fish_prompts that display it.
54+
set -l old_status $status
55+
5356
# Prompt override provided?
5457
# If not, just prepend the environment name.
5558
if test -n "__VIRTUAL_PROMPT__"
5659
printf '%s%s' "__VIRTUAL_PROMPT__" (set_color normal)
5760
else
5861
printf '%svirtualenv:%s %s%s%s\n' (set_color white) (set_color normal) (set_color -b black white) (basename $VIRTUAL_ENV) (set_color normal)
5962
end
60-
63+
64+
# Restore the original $status
65+
source "exit $old_status" | source
6166
_old_fish_prompt
6267
end
6368

0 commit comments

Comments
 (0)