]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph.in: fix ^C handling in watch (trap exception in while, too)
authorDan Mick <dan.mick@inktank.com>
Thu, 20 Jun 2013 22:11:03 +0000 (15:11 -0700)
committerDan Mick <dan.mick@inktank.com>
Thu, 20 Jun 2013 22:14:36 +0000 (15:14 -0700)
Signed-off-by: Dan Mick <dan.mick@inktank.com>
src/ceph.in

index 2f1390afdad2ae77e86f4b3de9cc1ddfd95c77e5..b3c001d9a67200b461e68ebadc2286fc1befa5f3 100755 (executable)
@@ -1489,7 +1489,7 @@ def main():
         # an awfully simple callback
         def watch_cb(arg, line, who, stamp_sec, stamp_nsec, seq, level, msg):
             print line
-           sys.stdout.flush()
+            sys.stdout.flush()
 
         # first do a ceph status
         ret, outbuf, outs = json_command(prefix='status')
@@ -1507,13 +1507,14 @@ def main():
         # this instance keeps the watch connection alive, but is
         # otherwise unused
         logwatch = rados.MonitorLog(cluster_handle, level, watch_cb, 0)
+
         # loop forever letting watch_cb print lines
-        while True:
-            try:
+        try:
+            while True:
                 pass
-            except KeyboardInterrupt:
-                # or until ^C, at least
-                return 0
+        except KeyboardInterrupt:
+            # or until ^C, at least
+            return 0
 
     # read input file, if any
     inbuf = ''