summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDima Krasner <dima@dimakrasner.com>2022-07-19 20:12:03 +0300
committerLeonardo Hernández <leohdz172@protonmail.com>2022-07-19 12:18:16 -0500
commitdeb48ff48b186ff77a7e9d3b3ab724ff4c3c340f (patch)
treedf639c8126a77e0eea20fb3ee10b8a2beeb65b07
parentc70db2d06a7c868ba2d36de0984f5b39afd1a1c6 (diff)
force line-buffered stdout if stdout is not a tty
-rw-r--r--dwl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/dwl.c b/dwl.c
index 7a585d5..6464289 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1674,7 +1674,6 @@ printstatus(void)
sel, urg);
printf("%s layout %s\n", m->wlr_output->name, m->lt[m->sellt]->symbol);
}
- fflush(stdout);
}
void
@@ -1943,6 +1942,9 @@ setsel(struct wl_listener *listener, void *data)
void
setup(void)
{
+ /* Force line-buffered stdout */
+ setvbuf(stdout, NULL, _IOLBF, 0);
+
/* The Wayland display is managed by libwayland. It handles accepting
* clients from the Unix socket, manging Wayland globals, and so on. */
dpy = wl_display_create();