From 299be2cb38c899a4d11ef7efdf16be63be418365 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Sun, 15 Feb 2015 00:21:14 -0600 Subject: [PATCH] watchedpath: Flush stdio more often When stdout/stderr is redirected to a file, they are typically opened in fully-buffered mode. This makes it difficult to watch logs in real time, unless the buffer is flushed every time a new message is written. --- src/watchedpath.vala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/watchedpath.vala b/src/watchedpath.vala index 9bff2f2..4f1ab11 100644 --- a/src/watchedpath.vala +++ b/src/watchedpath.vala @@ -43,6 +43,7 @@ namespace onchanged { if (_monitors.get(path) == null) { if (onchanged.debug) { stdout.printf("Watching path %s\n", path); + stdout.flush(); } FileMonitor mon; try { @@ -51,6 +52,7 @@ namespace onchanged { stderr.printf( "Failed to monitor %s: %s\n", path, e.message ); + stderr.flush(); return; } mon.changed.connect(handle_event); @@ -122,6 +124,7 @@ namespace onchanged { .replace("$%", event); if (onchanged.debug) { stdout.printf("%s\n", command); + stdout.flush(); } try { string[] argv;