]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph: only use readline when in interactive mode
authorSage Weil <sage@inktank.com>
Wed, 12 Jun 2013 23:22:45 +0000 (16:22 -0700)
committerSage Weil <sage@inktank.com>
Thu, 13 Jun 2013 00:13:39 +0000 (17:13 -0700)
A mere

  import readline

line is dumping this to stdout on CentOS 6.3:

  00000000  1b 5b 3f 31 30 33 34 68  .[?1034h

That confuses non-terminals that read from stdout, so only import when we
are in the interactive mode.

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
src/ceph.in

index 18e518669dc395e55c036fe883b4fe8309918204..857197185f436bf96c154c742dc67ed3bbaa254e 100755 (executable)
@@ -37,8 +37,6 @@ import copy
 import errno
 import json
 import rados
-# for raw_input to do readline cmd editing
-import readline
 import socket
 import stat
 import string
@@ -1220,6 +1218,8 @@ def new_style_command(parsed_args, cmdargs, target, sigdict, inbuf, verbose):
                 return -errno.EINVAL, '', 'invalid command'
         else:
             # do the command-interpreter looping
+            # for raw_input to do readline cmd editing
+            import readline
             while True:
                 interactive_input = raw_input('ceph> ')
                 if interactive_input in ['q', 'quit', 'Q']: