]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
ceph.in: write bytes to stdout in raw_write()
authorKefu Chai <kchai@redhat.com>
Tue, 27 Nov 2018 11:00:15 +0000 (19:00 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 27 Nov 2018 11:26:08 +0000 (19:26 +0800)
commit319c8507ea3fc37f6d8a57f63181fe27c7e445fe
tree118767bedee4dc9bc8391ba59300c86163c9cfc6
parent232a89069beb611c54947925b6d84ffa15936e8b
ceph.in: write bytes to stdout in raw_write()

in python3, sys.stdout.buffer is an io.BufferedWriter, while in python2
`sys.__stdout__` is a plain file. the former only accepts "bytes". so if
we send it a "str", it complains:

TypeError: a bytes-like object is required, not 'str'

it happens when quitting from the interactive mode of ceph CLI. in that
case, `new_style_command()` returns a tuple of `0, '\n', ''`, where the
second element is a str.

in this change, we always send `bytes` to raw_stdout.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/ceph.in