From bdfc7593509f7ea20943a81de3b3932b03d4f7e8 Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Tue, 21 Mar 2017 18:03:17 -0700 Subject: [PATCH] Don't write `\b` when output is redirected Fixes #6096 --- src/Microsoft.DotNet.Archive/ConsoleProgressReport.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.DotNet.Archive/ConsoleProgressReport.cs b/src/Microsoft.DotNet.Archive/ConsoleProgressReport.cs index 91e555c37..e8f6cd0df 100644 --- a/src/Microsoft.DotNet.Archive/ConsoleProgressReport.cs +++ b/src/Microsoft.DotNet.Archive/ConsoleProgressReport.cs @@ -29,9 +29,16 @@ namespace Microsoft.DotNet.Archive string line = $"{value.Phase} {progress}%"; if (value.Phase == _currentPhase) { - Console.Write(new string('\b', _lastLineLength)); + if (Console.IsOutputRedirected) + { + Console.Write($"...{progress}%"); + } + else + { + Console.Write(new string('\b', _lastLineLength)); + Console.Write(line); + } - Console.Write(line); _lastLineLength = line.Length; if (progress == 100)