From 69e1a9121d51d7655b0f6108cb81e727238d8045 Mon Sep 17 00:00:00 2001 From: Dan Mick Date: Thu, 20 Jun 2013 15:11:03 -0700 Subject: [PATCH] ceph.in: fix ^C handling in watch (trap exception in while, too) Signed-off-by: Dan Mick --- src/ceph.in | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ceph.in b/src/ceph.in index 2f1390afdad2a..b3c001d9a6720 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -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 = '' -- 2.39.5