From 189164081ed93a0181fe5869f8e2299eb748b5fb Mon Sep 17 00:00:00 2001 From: Brandon Milton Date: Sat, 10 Feb 2018 11:28:46 -0800 Subject: [PATCH] 'x' and 'a' filemodes use stdout when file is '-' --- click/_compat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/click/_compat.py b/click/_compat.py index d072224c1..be9f74360 100644 --- a/click/_compat.py +++ b/click/_compat.py @@ -423,7 +423,7 @@ def open_stream(filename, mode='r', encoding=None, errors='strict', # Standard streams first. These are simple because they don't need # special handling for the atomic flag. It's entirely ignored. if filename == '-': - if 'w' in mode: + if any(m in mode for m in ['w', 'a', 'x']): if 'b' in mode: return get_binary_stdout(), False return get_text_stdout(encoding=encoding, errors=errors), False