make bash version check case insensitive (#4399)

the output of `bash --version` is different when the system is configured for e.g. de_DE locale. For german locale the it's `GNU bash, Version 5.0…` with an uppercase 'V'. This makes the bash completion setup fail with the error `Error: The minimal supported Bash version is 4.4`.

To fix this, the version match regex now uses the `IGNORECASE` flag.
This commit is contained in:
Florian Sievers
2022-08-24 12:44:56 +02:00
committed by GitHub
parent 1cbc424488
commit af21c50aec

View File

@ -30,7 +30,7 @@ class ShellType(Enum):
def get_bash_version():
result = subprocess.run(["bash", "--version"], capture_output=True, check=True)
match = re.search(r"version\s+(\d+)\.(\d+)", result.stdout.decode())
match = re.search(r"version\s+(\d+)\.(\d+)", result.stdout.decode(), re.IGNORECASE)
if match:
return (int(match.group(1)), int(match.group(2)))
return (0, 0)