From 6f7e8e668e50cce712e40a3cc3b5b0e8fd4db741 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 24 Feb 2019 16:17:40 +0100 Subject: [PATCH] [RFC/WIP] call awesome_restart_delayed via main loop Fixes `echo 'awesome.restart()' | awesome-client` to not display an error about failed dbus-send, caused by awesome restarting before replying through DBus. --- awesome.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/awesome.c b/awesome.c index 4063a490e..4e8f529ea 100644 --- a/awesome.c +++ b/awesome.c @@ -524,12 +524,19 @@ exit_on_signal(gpointer data) return TRUE; } -void -awesome_restart(void) +static gboolean +awesome_restart_delayed(gpointer unused) { awesome_atexit(true); execvp(awesome_argv[0], awesome_argv); fatal("execv() failed: %s", strerror(errno)); + return true; +} + +void +awesome_restart(void) +{ + g_idle_add_full(G_PRIORITY_DEFAULT, awesome_restart_delayed, NULL, NULL); } /** Function to restart awesome on some signals.