Don't write \b when output is redirected

Fixes #6096
This commit is contained in:
Matt Ellis 2017-03-21 18:03:17 -07:00
parent 09f07e8b04
commit bdfc759350

View file

@ -28,10 +28,17 @@ namespace Microsoft.DotNet.Archive
{ {
string line = $"{value.Phase} {progress}%"; string line = $"{value.Phase} {progress}%";
if (value.Phase == _currentPhase) if (value.Phase == _currentPhase)
{
if (Console.IsOutputRedirected)
{
Console.Write($"...{progress}%");
}
else
{ {
Console.Write(new string('\b', _lastLineLength)); Console.Write(new string('\b', _lastLineLength));
Console.Write(line); Console.Write(line);
}
_lastLineLength = line.Length; _lastLineLength = line.Length;
if (progress == 100) if (progress == 100)