py3: Fix console_print

This commit is contained in:
Kovid Goyal 2019-04-17 11:22:05 +05:30
parent 1a3d09a61b
commit a5aec9233f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -68,7 +68,9 @@ def console_print(ctx, rd):
raise HTTPForbidden('console printing is not allowed')
with print_lock:
print(rd.remote_addr, end=' ')
shutil.copyfileobj(rd.request_body_file, sys.stdout)
stdout = getattr(sys.stdout, 'buffer', sys.stdout)
shutil.copyfileobj(rd.request_body_file, stdout)
stdout.flush()
return ''