From 0dfd2a64ec7c2ae1cfd9c97ec37b9d17c4c42977 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sat, 28 Jan 2012 10:38:31 -0800 Subject: [PATCH] Make stderr line-buffered w/--msgs2stderr. --- options.c | 6 ++++++ rsync.yo | 3 +++ 2 files changed, 9 insertions(+) diff --git a/options.c b/options.c index 5b2bfc1d..c556617d 100644 --- a/options.c +++ b/options.c @@ -1852,6 +1852,12 @@ int parse_arguments(int *argc_p, const char ***argv_p) } setvbuf(stdout, (char *)NULL, mode, 0); } + + if (msgs2stderr) { + /* Make stderr line buffered for better sharing of the stream. */ + fflush(stderr); /* Just in case... */ + setvbuf(stderr, (char *)NULL, _IOLBF, 0); + } #endif set_output_verbosity(verbose, DEFAULT_PRIORITY); diff --git a/rsync.yo b/rsync.yo index f5bc2baf..a0620899 100644 --- a/rsync.yo +++ b/rsync.yo @@ -565,6 +565,9 @@ messages back to the client side, so if you are doing any daemon-transfer debugging using this option, you should start up a daemon using bf(--no-detach) so that you can see the stderr output on the daemon side. +This option has the side-effect of making stderr output get line-buffered so +that the merging of the output of 3 programs happens in a more readable manner. + dit(bf(-q, --quiet)) This option decreases the amount of information you are given during the transfer, notably suppressing information messages from the remote server. This option is useful when invoking rsync from -- 2.47.2