Skip to content

Commit

Permalink
Workaround for #238 regression / #245 issue (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
melomac authored May 13, 2024
1 parent ee0fa51 commit 78bf552
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Release type: patch

Restore support for older versions of Fish.
10 changes: 6 additions & 4 deletions virtualfish/loader/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ def check_fish_version():
"""Display a warning if the minimum Fish version is not installed. Bail silently if
the 'packaging' module is missing or if Fish is not installed."""
try:
import re
import subprocess
from packaging import version

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

0 comments on commit 78bf552

Please sign in to comment.