Commit 58c37040 authored by Guido Gunther's avatar Guido Gunther Committed by Guido Gunther
Browse files

fbcli: Quit main loop on CTRL-C / SIGTERM

This makes sure we invoke the cleanup function correctly and allows
to test running event handling.
parent 49dab605
......@@ -8,6 +8,7 @@
#include <glib.h>
#include <gio/gio.h>
#include <glib-unix.h>
#include <locale.h>
......@@ -15,6 +16,15 @@
static GMainLoop *loop;
static gboolean
on_shutdown_signal (gpointer unused)
{
/* End right away, lfb_uninit will end running feedback */
g_main_loop_quit (loop);
return FALSE;
}
static gboolean
on_watch_expired (gpointer unused)
{
......@@ -55,6 +65,9 @@ trigger_event(const char *name, gint timeout)
g_autoptr(GIOChannel) input = NULL;
int success = FALSE;
g_unix_signal_add (SIGTERM, on_shutdown_signal, NULL);
g_unix_signal_add (SIGINT, on_shutdown_signal, NULL);
g_print("Triggering feedback for event '%s'\n", name);
event = lfb_event_new (name);
lfb_event_set_timeout (event, timeout);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment