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>
def raw_write(buf):
sys.stdout.flush()
- raw_stdout.write(buf)
+ raw_stdout.write(rados.cstr(buf, ''))
def osdids():