Skip to content
Open
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 @@ -29,6 +29,9 @@ Unreleased
non-shadowed help option names, so ``Try '... -h'`` no longer points to a
subcommand option that shadows ``-h``. All surviving names are shown
(``-h/--help``). :issue:`2790` :pr:`3208`
- 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