Skip to content

Commit 9db37a1

Browse files
committed
activate.fish: update fish major version check
Use fish's `string sub` command to get fish's major version from `$FISH_VERSION`. The `head` program in OpenBSD does not have the `-c` flag. [main-head]: https://man.openbsd.org/head
1 parent fa647d5 commit 9db37a1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/virtualenv/activation/fish/activate.fish

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function deactivate -d 'Exit virtualenv mode and return to the normal environmen
1818
# reset old environment variables
1919
if test -n "$_OLD_VIRTUAL_PATH"
2020
# https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling
21-
if test (echo $FISH_VERSION | head -c 1) -lt 3
21+
if test (string sub -s 1 -l 1 $FISH_VERSION) -lt 3
2222
set -gx PATH (_fishify_path "$_OLD_VIRTUAL_PATH")
2323
else
2424
set -gx PATH $_OLD_VIRTUAL_PATH
@@ -61,7 +61,7 @@ deactivate nondestructive
6161
set -gx VIRTUAL_ENV __VIRTUAL_ENV__
6262

6363
# https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling
64-
if test (echo $FISH_VERSION | head -c 1) -lt 3
64+
if test (string sub -s 1 -l 1 $FISH_VERSION) -lt 3
6565
set -gx _OLD_VIRTUAL_PATH (_bashify_path $PATH)
6666
else
6767
set -gx _OLD_VIRTUAL_PATH $PATH

0 commit comments

Comments
 (0)