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.master
parent
439a53940c
commit
299be2cb38
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue