Skip to content

Commit

Permalink
fix: output option errors with text response (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackie-linz authored Aug 26, 2024
1 parent dbb7d61 commit b5405e3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions awscurl/awscurl.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,12 @@ def inner_main(argv):

if args.output:
filename = args.output
file_mode = "wb" if args.data_binary else "w"
with open(filename, file_mode) as f:
f.write(response.content)
if args.data_binary:
with open(filename, "wb") as f:
f.write(response.content)
else:
with open(filename, "w") as f:
f.write(response.text)

exit_code = 0 if response.ok else 1

Expand Down

0 comments on commit b5405e3

Please sign in to comment.