Skip to content
Myr

More robust check of bash version (#2639)

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

authored by Nils Hjelte · committed by GitHub · parent 26aa7bf · Browse files · 2 files+13 added−5 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+13 added−5 removed

  • other:+13 added−5 removed

2 files+13 added−5 removed

modified:src/click/shell_completion.py+11 added-4 removed
301 unmodified lines
302 source_template = _SOURCE_BASH303304 @staticmethod305 def _check_version() -> None:306 import shutil307 import subprocess308308 output = subprocess.run(309 ["bash", "-c", 'echo "${BASH_VERSION}"'], stdout=subprocess.PIPE310 )311 match = re.search(r"^(\d+)\.(\d+)\.\d+", output.stdout.decode())309 bash_exe = shutil.which("bash")310311 if bash_exe is None:312 match = None313 else:314 output = subprocess.run(315 [bash_exe, "--norc", "-c", 'echo "${BASH_VERSION}"'],316 stdout=subprocess.PIPE,317 )318 match = re.search(r"^(\d+)\.(\d+)\.\d+", output.stdout.decode())319320 if match is not None:321 major, minor = match.groups()322323 if major < "4" or major == "4" and minor < "4":
280 unmodified lines
modified:CHANGES.rst+2 added-1 removed
14 unmodified lines
15- Show correct value for flag default when using ``default_map``.16 :issue:`2632`17- Fix ``click.echo(color=...)`` passing ``color`` to coloroma so it can be18 forced on Windows. :issue:`2606`.19- More robust bash version check, fixing problem on Windows with git-bash.20 :issue:`2638`212022Version 8.1.723-------------2425Released 2023-08-17
1100 unmodified lines