Repository navigation
Color contamination fix - #1463
Akinwale Alagbe (hackean-msft) wants to merge 7 commits into
Conversation
check-spelling-bot ReportUnrecognized words, please review:
Previously acknowledged words that are now absentATL Globals IInstalledTo accept these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands... in a clone of the [email protected]:microsoft/winget-cli.git repository |
… user/akalagbe/color-contamination-fix
check-spelling-bot ReportUnrecognized words, please review:
Previously acknowledged words that are now absentATL Globals IInstalledTo accept these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands... in a clone of the [email protected]:microsoft/winget-cli.git repository |
|
|
||
| void BaseStream::Close() | ||
| { | ||
| m_enabled = false; |
There was a problem hiding this comment.
If this were a single shared object that every OutputStream had a reference to, at least m_enabled would need to be updated to be std::atomic_bool to prevent a race at Close.
… user/akalagbe/color-contamination-fix
… user/akalagbe/color-contamination-fix
JohnMcPMS
left a comment
There was a problem hiding this comment.
I think that my casual use of the word "base" in a previous statement may have lead to this design, which I don't think is the right pattern. It is also bogged down by a lot of unnecessary name changes which make it a bit harder to see the actual functional changes.
My suggestion is to have the stream object that can be disabled as a singular member of the Reporter, replacing the current std::ostream m_out. That object is given out in place of the current m_out and treated almost identically otherwise. That keeps the code change minimal while achieving the goal of allowing all output to be disabled through a central mechanism.
| { | ||
| case Level::Verbose: | ||
| result.AddFormat(TextFormat::Default); | ||
| m_vtOutputStream.AddFormat(TextFormat::Default); |
There was a problem hiding this comment.
This may look like its working, but you are creating an ever expanding list of formats that must be output each time. It also will not work in the event of asynchronous operations (although we don't really have those at the moment, it would make having any harder in the future).
Reset console to default color when user force quits(hits ctrl + c twice) during execution.
Channel all console output write operations only through OutputStream/BaseStream wrappers.
Microsoft Reviewers: Open in CodeFlow