fix: handle isatty correctly (#18277)
sys.stdin can be `None` [skip ci]
This commit is contained in:
parent
513321810d
commit
35ba00a54e
2 changed files with 2 additions and 2 deletions
|
|
@ -452,7 +452,7 @@ def msgprint(
|
|||
if as_list and type(msg) in (list, tuple):
|
||||
out.as_list = 1
|
||||
|
||||
if sys.stdin.isatty():
|
||||
if sys.stdin and sys.stdin.isatty():
|
||||
msg = _strip_html_tags(out.message)
|
||||
|
||||
if flags.print_messages and out.message:
|
||||
|
|
|
|||
|
|
@ -557,7 +557,7 @@ def is_cli() -> bool:
|
|||
try:
|
||||
invoked_from_terminal = bool(os.get_terminal_size())
|
||||
except Exception:
|
||||
invoked_from_terminal = sys.stdin.isatty()
|
||||
invoked_from_terminal = sys.stdin and sys.stdin.isatty()
|
||||
return invoked_from_terminal
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue