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 (_monitors.get(path) == null) {
|
||||||
if (onchanged.debug) {
|
if (onchanged.debug) {
|
||||||
stdout.printf("Watching path %s\n", path);
|
stdout.printf("Watching path %s\n", path);
|
||||||
|
stdout.flush();
|
||||||
}
|
}
|
||||||
FileMonitor mon;
|
FileMonitor mon;
|
||||||
try {
|
try {
|
||||||
|
@ -51,6 +52,7 @@ namespace onchanged {
|
||||||
stderr.printf(
|
stderr.printf(
|
||||||
"Failed to monitor %s: %s\n", path, e.message
|
"Failed to monitor %s: %s\n", path, e.message
|
||||||
);
|
);
|
||||||
|
stderr.flush();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mon.changed.connect(handle_event);
|
mon.changed.connect(handle_event);
|
||||||
|
@ -122,6 +124,7 @@ namespace onchanged {
|
||||||
.replace("$%", event);
|
.replace("$%", event);
|
||||||
if (onchanged.debug) {
|
if (onchanged.debug) {
|
||||||
stdout.printf("%s\n", command);
|
stdout.printf("%s\n", command);
|
||||||
|
stdout.flush();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
string[] argv;
|
string[] argv;
|
||||||
|
|
Loading…
Reference in New Issue