Skip to content
Myr

fix: `_termui_impl.open_url()` — 'start' on Windows is a cmd built-in, not an executable (#3186)

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

authored by Adam Karpierz · committed by GitHub · parent 2468b70 · Browse files · 2 files+12 added−10 removed
This commit

State

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

Trailers

  • Co-authored-by: Kevin Deldycke <kevin@deldycke.com>

Diff stats

2 files+12 added−10 removed

  • other:+12 added−10 removed

2 files+12 added−10 removed

modified:src/click/_termui_impl.py+9 added-10 removed
718 unmodified lines
719 elif WIN:720 if locate:721 url = _unquote_file(url)722 args = ["explorer", f"/select,{url}"]723 try:724 return subprocess.call(args)725 except OSError:726 return 127727 else:724 args = ["start"]725 if wait:726 args.append("/WAIT")727 args.append("")728 args.append(url)729 try:730 return subprocess.call(args)731 except OSError:732 # Command not found733 return 127728 try:729 os.startfile(url) # type: ignore[attr-defined]730 except OSError:731 return 127732 return 0733 elif CYGWIN:734 if locate:735 url = _unquote_file(url)736 args = ["cygstart", os.path.dirname(url)]
133 unmodified lines
modified:CHANGES.rst+3 added
40 unmodified lines
41- Fix readline functionality on non-Windows platforms. Prompt text is now42 passed directly to readline instead of being printed separately, allowing43 proper backspace, line editing, and line wrapping behavior. :issue:`2968`44 :pr:`2969`45- Use :func:`os.startfile` on Windows to open URLs in :func:`open_url`,46 replacing the ``start`` built-in which cannot be invoked without47 ``shell=True``. :issue:`3164` :pr:`3186`4849Version 8.3.350-------------51
1364 unmodified lines