[sysprof/wip/chergert/control-fd] cli: add some status information from ^C



commit 945edf566425777cbba726ab5c19b50835455f1a
Author: Christian Hergert <chergert redhat com>
Date:   Tue Feb 11 15:11:51 2020 -0800

    cli: add some status information from ^C

 src/tools/sysprof-cli.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/tools/sysprof-cli.c b/src/tools/sysprof-cli.c
index 77f46cc..0364f29 100644
--- a/src/tools/sysprof-cli.c
+++ b/src/tools/sysprof-cli.c
@@ -46,20 +46,30 @@ sigint_handler (gpointer user_data)
 {
   static int count;
 
+  if (count >= 2)
+    {
+      g_main_loop_quit (main_loop);
+      return G_SOURCE_REMOVE;
+    }
+
+  g_printerr ("\n");
+
   if (count == 0)
-    sysprof_profiler_stop (profiler);
-  else if (count > 2)
-    g_main_loop_quit (main_loop);
+    {
+      sysprof_profiler_stop (profiler);
+      g_printerr ("%s\n", _("Stopping profiler. Press twice more ^C to force exit."));
+    }
 
   count++;
 
-  return G_SOURCE_REMOVE;
+  return G_SOURCE_CONTINUE;
 }
 
 static void
 profiler_stopped (SysprofProfiler *profiler_,
                   GMainLoop       *main_loop_)
 {
+  g_printerr ("%s\n", _("Profiler stopped."));
   g_main_loop_quit (main_loop);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]