Skip to content
Myr

bash version support shows warning instead of error

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

authored by Olivia Kinnear · committed by David Lord · parent 22b9b1c · Browse files · 2 files+9 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+9 added−5 removed

  • other:+9 added−5 removed

2 files+9 added−5 removed

modified:src/click/shell_completion.py+8 added-5 removed
299 unmodified lines
300301 name = "bash"302 source_template = _SOURCE_BASH303304 @staticmethod304 def _check_version(self) -> None:305 def _check_version() -> None:306 import subprocess307308 output = subprocess.run(309 ["bash", "-c", 'echo "${BASH_VERSION}"'], stdout=subprocess.PIPE
3 unmodified lines
313 if match is not None:314 major, minor = match.groups()315316 if major < "4" or major == "4" and minor < "4":316 raise RuntimeError(317 echo(318 _(319 "Shell completion is not supported for Bash"320 " versions older than 4.4."320 )321 ),322 err=True,323 )324 else:323 raise RuntimeError(324 _("Couldn't detect Bash version, shell completion is not supported.")325 echo(326 _("Couldn't detect Bash version, shell completion is not supported."),327 err=True,328 )329330 def source(self) -> str:331 self._check_version()
265 unmodified lines
modified:CHANGES.rst+1 added
4 unmodified lines
56Unreleased78- Fix issue with regex flags in shell completion. :issue:`2581`9- Bash version detection issues a warning instead of an error. :issue:`2574`101112Version 8.1.613-------------
1092 unmodified lines