Skip to content

Commit

Permalink
reduce ProgressBar overhead in silent mode
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrit committed Jan 6, 2025
1 parent 9fb81e0 commit 64def4c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions SeeSharp/Common/ProgressBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,11 @@ public ProgressBar(int numBlocks = 20, bool displayWork = true, bool displayTime
this.prefix = prefix;

// Detect if our output has been "polluted" by other printed messages
watcher = new(Console.Out);
Console.SetOut(watcher);
watcher.WriteCharEvent += OnOtherOutput;
if (!Silent) {
watcher = new(Console.Out);
Console.SetOut(watcher);
watcher.WriteCharEvent += OnOtherOutput;
}
}

/// <summary>
Expand Down

0 comments on commit 64def4c

Please sign in to comment.