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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user