diff options
author | Benedikt Loeffler <benedikt.loeffler@bmw.de> | 2021-10-13 13:50:36 +0200 |
---|---|---|
committer | Cyril Roelandt <cyril@redhat.com> | 2022-07-08 04:38:59 +0200 |
commit | f0ccd09ad5976cc67eaca244c820a7106aecf4c5 (patch) | |
tree | fb2f92f63e8f569e864113e662bf1e82e3d6d800 /glanceclient/common/utils.py | |
parent | 0b4d5a6200f638fc299d4cffa1c2f4367a6c6e80 (diff) | |
download | python-glanceclient-stable/xena.tar.gz |
Check if stdin has isatty attributestable/xena
When the stdin is closed, it has no isatty atrribute which leads to a KeyError.
Closes-Bug: #1980890
Change-Id: If9a3bf68b8dfd953b346697241166578d18bb563
(cherry picked from commit 8df9328a60045edae36dc64cee1f2cf3cd4a09fa)
(cherry picked from commit 2ad5f0a6b07c25cc8bc371a92baea3d1c52161ad)
Diffstat (limited to 'glanceclient/common/utils.py')
-rw-r--r-- | glanceclient/common/utils.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/glanceclient/common/utils.py b/glanceclient/common/utils.py index 1691264..818a98c 100644 --- a/glanceclient/common/utils.py +++ b/glanceclient/common/utils.py @@ -405,7 +405,7 @@ def get_data_file(args): except OSError: # (1) stdin is not valid (closed...) return None - if not sys.stdin.isatty(): + if hasattr(sys.stdin, 'isatty') and not sys.stdin.isatty(): # (2) image data is provided through standard input image = sys.stdin if hasattr(sys.stdin, 'buffer'): |