Skip to content
Myr

bash version detection is locale independent

Before adoption: this commit came in with the history the project adopted, so no landing records it.

The `BASH_VERSION` variable holds the bash version number in a much better consumable and especially locale independent format than the `--version` flag.

authored by Jan Losinski · committed by David Lord · parent 3d0d8b5 · Browse files · 2 files+5 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+5 added−2 removed

  • other:+5 added−2 removed

2 files+5 added−2 removed

modified:src/click/shell_completion.py+4 added-2 removed
300 unmodified lines
301302 def _check_version(self) -> None:303 import subprocess304305 output = subprocess.run(["bash", "--version"], stdout=subprocess.PIPE)306 match = re.search(r"version (\d)\.(\d)\.\d", output.stdout.decode())305 output = subprocess.run(306 ["bash", "-c", "echo ${BASH_VERSION}"], stdout=subprocess.PIPE307 )308 match = re.search(r"^(\d+)\.(\d+)\.\d+", output.stdout.decode())309310 if match is not None:311 major, minor = match.groups()312
264 unmodified lines
modified:CHANGES.rst+1 added
5 unmodified lines
6Unreleased78- ``is_bool_flag`` is not set to ``True`` if ``is_flag`` is ``False``.9 :issue:`1925`10- Bash version detection is locale independent. :issue:`1940`111213Version 8.0.114-------------
889 unmodified lines