Created
April 25, 2013 13:03
-
-
Save hughsaunders/5459519 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/glanceclient/v1/shell.py b/glanceclient/v1/shell.py | |
index 02d3c01..e1b2a35 100644 | |
--- a/glanceclient/v1/shell.py | |
+++ b/glanceclient/v1/shell.py | |
@@ -121,7 +121,10 @@ def _set_data_field(fields, args): | |
# (3) no image data provided: | |
# glance ... | |
try: | |
- os.fstat(0) | |
+ stat_result = os.fstat(0) | |
+ if stat_result.st_size == 0: | |
+ # (3) stdin is open but empty | |
+ fields['data'] = None | |
except OSError: | |
# (1) stdin is not valid (closed...) | |
fields['data'] = None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment