summaryrefslogtreecommitdiff
path: root/openstackclient/api
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-04-13 03:15:46 +0000
committerGerrit Code Review <review@openstack.org>2019-04-13 03:15:46 +0000
commit3b5dd14b80209278c53b4c08e60b9a115229eabb (patch)
tree4e87d70f37606155ae6ca3c43bbce994ac058801 /openstackclient/api
parentee193e67a9eef8e124dd572f6df064e5c0259717 (diff)
parent415b48056d9d021e04ec972029040a89a6b13928 (diff)
downloadpython-openstackclient-3b5dd14b80209278c53b4c08e60b9a115229eabb.tar.gz
Merge "Before writing object data to stdout, re-open it in binary mode"
Diffstat (limited to 'openstackclient/api')
-rw-r--r--openstackclient/api/object_store_v1.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/openstackclient/api/object_store_v1.py b/openstackclient/api/object_store_v1.py
index 31033525..d1e5dfaf 100644
--- a/openstackclient/api/object_store_v1.py
+++ b/openstackclient/api/object_store_v1.py
@@ -378,8 +378,9 @@ class APIv1(api.BaseAPI):
)
if response.status_code == 200:
if file == '-':
- for chunk in response.iter_content(64 * 1024):
- sys.stdout.write(chunk)
+ with os.fdopen(sys.stdout.fileno(), 'wb') as f:
+ for chunk in response.iter_content(64 * 1024):
+ f.write(chunk)
else:
if not os.path.exists(os.path.dirname(file)):
if len(os.path.dirname(file)) > 0: