Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ Unreleased
passed directly to readline instead of being printed separately, allowing
proper backspace, line editing, and line wrapping behavior. :issue:`2968`
:pr:`2969`
- Use :func:`os.startfile` on Windows to open URLs in :func:`open_url`,
replacing the ``start`` built-in which cannot be invoked without
``shell=True``. :issue:`3164` :pr:`3186`

Version 8.3.3
-------------
Expand Down
19 changes: 9 additions & 10 deletions src/click/_termui_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,17 +720,16 @@ def _unquote_file(url: str) -> str:
if locate:
url = _unquote_file(url)
args = ["explorer", f"/select,{url}"]
try:
return subprocess.call(args)
except OSError:
return 127
else:
args = ["start"]
if wait:
args.append("/WAIT")
args.append("")
args.append(url)
try:
return subprocess.call(args)
except OSError:
# Command not found
return 127
try:
os.startfile(url) # type: ignore[attr-defined]
except OSError:
return 127
return 0
elif CYGWIN:
if locate:
url = _unquote_file(url)
Expand Down