]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
Make stderr line-buffered w/--msgs2stderr.
authorWayne Davison <wayned@samba.org>
Sat, 28 Jan 2012 18:38:31 +0000 (10:38 -0800)
committerWayne Davison <wayned@samba.org>
Sat, 28 Jan 2012 18:42:01 +0000 (10:42 -0800)
options.c
rsync.yo

index 5b2bfc1d66c39f091c5c0ef868b59d9596788d81..c556617d124db9d5898a9ec3daa79bc7158350da 100644 (file)
--- 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);
index f5bc2bafb3b73b13a0c4541db619e51161691da0..a0620899a0fa5ef3a58fff35a311573915666002 100644 (file)
--- 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