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 @@ -5,6 +5,9 @@ Version 8.3.3

Unreleased

- 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`
- Use :func:`shlex.split` to split pager and editor commands into ``argv``
lists for :class:`subprocess.Popen`, removing ``shell=True``.
:issue:`1026` :pr:`1477` :pr:`2775`
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