summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Philips <brandon@ifup.org>2012-09-03 18:37:46 -0700
committerLennart Poettering <lennart@poettering.net>2012-09-03 19:16:20 -0700
commite268b81e97833a4636dba476056fa936c4da5796 (patch)
tree0169ffa2b346cea9293b8d1fe120140557d21f6e
parent88f89a9b6d25dfcb89691727c8cdaf01f4090b72 (diff)
shared: logs-show: fflush after each output type
journalctl -f redirected to a pipe or file wasn't working for some output formats but was working for json. It turns out only json was doing an fflush. Make all output formats flush.
-rw-r--r--src/shared/logs-show.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 99407c9c1d..67b20563df 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -521,7 +521,6 @@ static int output_json(sd_journal *j, unsigned line,
}
fputs("\n}", stdout);
- fflush(stdout);
return 0;
}
@@ -560,13 +559,16 @@ static int (*output_funcs[_OUTPUT_MODE_MAX])(sd_journal*j, unsigned line,
int output_journal(sd_journal *j, OutputMode mode, unsigned line,
unsigned n_columns, OutputFlags flags) {
+ int ret;
assert(mode >= 0);
assert(mode < _OUTPUT_MODE_MAX);
if (n_columns <= 0)
n_columns = columns();
- return output_funcs[mode](j, line, n_columns, flags);
+ ret = output_funcs[mode](j, line, n_columns, flags);
+ fflush(stdout);
+ return ret;
}
int show_journal_by_unit(