summaryrefslogtreecommitdiff
path: root/src/click/_compat.py
diff options
context:
space:
mode:
authorDavid Lord <davidism@gmail.com>2021-10-25 08:38:49 -0700
committerDavid Lord <davidism@gmail.com>2021-10-25 08:38:49 -0700
commitdf114b1eb791dfa1175d138f3a2108bba9bca080 (patch)
tree1e7b3961ed7c2ce26ffed36c0cf1db8826daf6ee /src/click/_compat.py
parent41f5b7a7967bb65910e8837bd4e8542a18feec6c (diff)
downloadclick-df114b1eb791dfa1175d138f3a2108bba9bca080.tar.gz
open_file hanldes pathlib.Path("-")
Diffstat (limited to 'src/click/_compat.py')
-rw-r--r--src/click/_compat.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/click/_compat.py b/src/click/_compat.py
index b9e1f0d..7154dfd 100644
--- a/src/click/_compat.py
+++ b/src/click/_compat.py
@@ -388,9 +388,9 @@ def open_stream(
) -> t.Tuple[t.IO, bool]:
binary = "b" in mode
- # Standard streams first. These are simple because they don't need
- # special handling for the atomic flag. It's entirely ignored.
- if filename == "-":
+ # Standard streams first. These are simple because they ignore the
+ # atomic flag. Use fsdecode to handle Path("-").
+ if os.fsdecode(filename) == "-":
if any(m in mode for m in ["w", "a", "x"]):
if binary:
return get_binary_stdout(), False