Skip to content

Commit 78bf552

Browse files
authored
Workaround for #238 regression / #245 issue (#247)
1 parent ee0fa51 commit 78bf552

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

RELEASE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Release type: patch
2+
3+
Restore support for older versions of Fish.

virtualfish/loader/cli.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ def check_fish_version():
2525
"""Display a warning if the minimum Fish version is not installed. Bail silently if
2626
the 'packaging' module is missing or if Fish is not installed."""
2727
try:
28+
import re
2829
import subprocess
2930
from packaging import version
3031

31-
cmd = ["fish", "-N", "-c", "echo $version"]
32-
fish_version = subprocess.check_output(cmd).decode("utf-8").strip()
33-
# Remove any extraneous hyphen-suffixed bits
34-
fish_version = fish_version.partition("-")[0]
32+
cmd = ["fish", "--version"]
33+
fish_output = subprocess.check_output(cmd).decode("utf-8")
34+
# Remove any extraneous prefix and hyphen-suffixed bits
35+
fish_matches = re.match(r".*version ([\d\.]+)", fish_output)
36+
fish_version = fish_matches.group(1)
3537
if version.parse(fish_version) < version.parse(minimum_fish_version):
3638
log.warning(
3739
"""{}WARNING: VirtualFish requires Fish {} or higher.

0 commit comments

Comments
 (0)