So far progress always uses \r to produce one-line output on stderr. This only produces useful and easy parsable output if stderr is opened on a file which does interpret CR as a real carriage return operation. This patch changes EOL to the plain newline \n control if isatty() is false instead. Signed-off-by: Steffen Daode Nurpmeso <sdaoden@xxxxxxxxx> --- progress.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/progress.c b/progress.c index 3971f49..c548de4 100644 --- a/progress.c +++ b/progress.c @@ -27,6 +27,7 @@ struct throughput { struct progress { const char *title; + const char *eol; int last_value; unsigned total; unsigned last_percent; @@ -90,7 +91,7 @@ static int display(struct progress *progress, unsigned n, const char *done) progress->last_value = n; tp = (progress->throughput) ? progress->throughput->display : ""; - eol = done ? done : " \r"; + eol = done ? done : progress->eol; if (progress->total) { unsigned percent = n * 100 / progress->total; if (percent != progress->last_percent || progress_update) { @@ -219,6 +220,7 @@ struct progress *start_progress_delay(const char *title, unsigned total, return NULL; } progress->title = title; + progress->eol = isatty(fileno(stderr)) ? " \r" : "\n"; progress->total = total; progress->last_value = -1; progress->last_percent = -1; -- 1.7.6.rc0 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html