From b6215001cf4008549e2d17f6dc57822ba4d24ab9 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sun, 4 Jun 2017 16:22:50 +1000 Subject: [PATCH] Add clear line to console_log only if stderr is going to console. --- src/ckpool.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ckpool.c b/src/ckpool.c index d3e71b4b..784a6a1f 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -57,7 +57,10 @@ static bool open_logfile(ckpool_t *ckp) * on any delays. */ static void console_log(ckpool_t __maybe_unused *ckp, char *msg) { - fprintf(stderr, "\33[2K\r%s", msg); + /* Add clear line only if stderr is going to console */ + if (isatty(fileno(stderr))) + fprintf(stderr, "\33[2K\r"); + fprintf(stderr, "%s", msg); fflush(stderr); free(msg);