aboutsummaryrefslogtreecommitdiff
path: root/notify.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-07-23 04:57:30 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-07-23 05:17:21 +0000
commita42f99081876dd02e28b931f7c0e70230355bb58 (patch)
treec49e60ec7ce07cead0767afd8d2bd896679a32af /notify.c
parentosc: kitty notifications: use body as title, if no title is set (diff)
spawn: add optional reaper callback, return pid_t
This will allow spawn() callers to do things when the spawned process has terminated.
Diffstat (limited to 'notify.c')
-rw-r--r--notify.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/notify.c b/notify.c
index 09e230a0..7cd22ccb 100644
--- a/notify.c
+++ b/notify.c
@@ -59,7 +59,11 @@ notify_notify(const struct terminal *term, const char *title, const char *body,
/* Redirect stdin to /dev/null, but ignore failure to open */
int devnull = open("/dev/null", O_RDONLY);
- spawn(term->reaper, NULL, argv, devnull, -1, -1, NULL);
+ pid_t pid = spawn(
+ term->reaper, NULL, argv, devnull, stdout_fds[1], -1,
+ &notif_done, (void *)term, NULL);
+
+ if (stdout_fds[1] >= 0) {
if (devnull >= 0)
close(devnull);