From: Kefu Chai Date: Fri, 4 Sep 2020 02:21:35 +0000 (+0800) Subject: ceph.in: read bytes from stdin X-Git-Tag: v16.1.0~1112^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0b8fdaa4bcdf204bd97e92b0a6241da8b9d1164a;p=ceph.git ceph.in: read bytes from stdin the data read from stdin is used as the input parameter for calls like `cluster.osd_command(...)` and `cluster.mon_command`. all of them expect a bytes `inbuf`. in Python2, this sys.stdin.read() returns a str, and we don't differentiate str from byte back then. but we need enforce the type now for better readablity and type correctness. Signed-off-by: Kefu Chai --- diff --git a/src/ceph.in b/src/ceph.in index d1f4d802214e..b2ceafbae65b 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -1104,7 +1104,7 @@ def main(): if parsed_args.input_file: try: if parsed_args.input_file == '-': - inbuf = sys.stdin.read() + inbuf = sys.stdin.buffer.read() else: with open(parsed_args.input_file, 'rb') as f: inbuf = f.read()