From: Julien Desfossez Date: Mon, 27 Aug 2012 03:44:12 +0000 (-0400) Subject: exit cleanly on ctrl+c in textdump live X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=828afa52c44e005619fb37f94f0122857a7298f6;p=lttngtop.git exit cleanly on ctrl+c in textdump live Signed-off-by: Julien Desfossez --- diff --git a/src/lttngtop.c b/src/lttngtop.c index 5c3267e..be323eb 100644 --- a/src/lttngtop.c +++ b/src/lttngtop.c @@ -90,6 +90,12 @@ static struct poptOption long_options[] = { { NULL, 0, 0, NULL, 0, NULL, NULL }, }; +static void handle_textdump_sigterm(int signal) +{ + quit = 1; + lttng_destroy_session("test"); +} + void *refresh_thread(void *p) { struct mmap_stream *mmap_info; @@ -1034,6 +1040,10 @@ int main(int argc, char **argv) } if (!opt_input_path) { + if (opt_textdump) { + signal(SIGTERM, handle_textdump_sigterm); + signal(SIGINT, handle_textdump_sigterm); + } ret = setup_live_tracing(); if (ret < 0) { goto end;