mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-26 06:46:13 +01:00
Fix 'api' command to stream output to avoid running out of memory
This commit is contained in:
parent
56f7cbafa1
commit
7aa68d0c8a
@ -8700,20 +8700,22 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
data=opts.data,
|
data=opts.data,
|
||||||
file=opts.file,
|
file=opts.file,
|
||||||
headers=opts.headers)
|
headers=opts.headers)
|
||||||
out = r.read()
|
|
||||||
|
|
||||||
if opts.edit:
|
if opts.edit:
|
||||||
|
# to edit the output, we need to read all of it
|
||||||
|
# it's going to run ouf of memory if the data is too big
|
||||||
|
out = r.read()
|
||||||
text = edit_text(out)
|
text = edit_text(out)
|
||||||
r = http_request("PUT",
|
r = http_request("PUT",
|
||||||
url,
|
url,
|
||||||
data=text,
|
data=text,
|
||||||
headers=opts.headers)
|
headers=opts.headers)
|
||||||
out = r.read()
|
|
||||||
|
|
||||||
if isinstance(out, str):
|
while True:
|
||||||
sys.stdout.write(out)
|
data = r.read(8192)
|
||||||
else:
|
if not data:
|
||||||
sys.stdout.buffer.write(out)
|
break
|
||||||
|
sys.stdout.buffer.write(data)
|
||||||
|
|
||||||
@cmdln.option('-b', '--bugowner-only', action='store_true',
|
@cmdln.option('-b', '--bugowner-only', action='store_true',
|
||||||
help='Show only the bugowner')
|
help='Show only the bugowner')
|
||||||
|
Loading…
Reference in New Issue
Block a user