From 4bf8b6b43b9640700eadd7c7d1a432dd91ef473d Mon Sep 17 00:00:00 2001 From: Ekaterina Vaartis Date: Thu, 8 Jun 2017 16:40:17 +0300 Subject: [PATCH 1/2] include stdint to be compaitable with musl --- wayland/pango.c | 1 + 1 file changed, 1 insertion(+) diff --git a/wayland/pango.c b/wayland/pango.c index 702ab15c..f9eec98c 100644 --- a/wayland/pango.c +++ b/wayland/pango.c @@ -5,6 +5,7 @@ #include #include #include +#include #include "log.h" PangoLayout *get_pango_layout(cairo_t *cairo, const char *font, const char *text, From 8f4bc0a3741b63c64bb6059bb632e7584c595d14 Mon Sep 17 00:00:00 2001 From: Yury Krivopalov Date: Mon, 12 Jun 2017 23:01:19 +0300 Subject: [PATCH 2/2] swaybar: Group child processes for signalling Fixes child proccess killing, when status_command is a complex command like "i3status | wrapper.sh". Set the process group id of the child process by calling `setpgid` after forking and before calling `exec`. The process group ID will be set to the process ID of the forked process. Processes spawned by this child process will also have this group ID. Send signals to the process group with `killpg`. This will send the signal to all of the process group. --- swaybar/bar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/swaybar/bar.c b/swaybar/bar.c index abde1cc9..5ed0d266 100644 --- a/swaybar/bar.c +++ b/swaybar/bar.c @@ -34,6 +34,7 @@ static void spawn_status_cmd_proc(struct bar *bar) { close(pipefd[0]); dup2(pipefd[1], STDOUT_FILENO); close(pipefd[1]); + setpgid(bar->status_command_pid, 0); char *const cmd[] = { "sh", "-c", @@ -274,7 +275,7 @@ static void free_outputs(list_t *outputs) { static void terminate_status_command(pid_t pid) { if (pid) { // terminate status_command process - int ret = kill(pid, SIGTERM); + int ret = killpg(pid, SIGTERM); if (ret != 0) { sway_log(L_ERROR, "Unable to terminate status_command [pid: %d]", pid); } else {