You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, even if the destructor of Reporter should reset the text formatting
Reporter::~Reporter()
{
// The goal of this is to return output to its previous state.
// For now, we assume this means "default".
GetBasicOutputStream() << TextFormat::Default;
}
I’ve reach a case where the text format isn't reset and spills into the next commands.
It may also spill between logs of winget-cli. I believe the error lies in the Reporter class that doesn't reset the text format properly a the end of the stream.
Steps to reproduce
Install a package with winget.
Expected behavior
The text format should be reset. I have to reset it by an explicit ANSI code.
I'm not aware of any way to get back to "just before we started" in terms of the console colors, so we reset to whatever the console considers the default state. I don't get the sense that this is what you are describing since your example of a fix does exactly that, but wanting to set expectations.
I'm not seeing this behavior locally. I'm using Windows Terminal (1.4.3243.0) and PowerShell (7.1.0.0), maybe it is related to your console/shell? Which are you using?
This was actually seen in docker build, for example:
# escape=`
FROM mcr.microsoft.com/windows:20H2
ADD https://aka.ms/vs/16/release/vc_redist.x64.exe C:\winget-cli\
ADD https://github.com/microsoft/winget-cli/releases/download/v0.2.3162-preview/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.appxbundle C:\winget-cli\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.zip
RUN C:\winget-cli\vc_redist.x64.exe /install /passive /norestart /log C:\winget-cli\vc_redist.log
RUN powershell -Command "Expand-Archive -LiteralPath C:\winget-cli\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.zip -DestinationPath C:\winget-cli\ -Force"
RUN ren C:\winget-cli\AppInstaller_x64.appx AppInstaller_x64.zip
RUN powershell -Command "Expand-Archive -LiteralPath C:\winget-cli\AppInstaller_x64.zip -DestinationPath C:\winget-cli\ -Force"
RUN md "C:\\Program Files\\winget-cli"
RUN copy "C:\\winget-cli\\AppInstallerCLI.exe" "C:\\Program Files\\winget-cli\\winget.exe"
RUN copy "C:\\winget-cli\\resources.pri" "C:\\Program Files\\winget-cli\\"
RUN for /f "tokens=1,2,*" %a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /V Path ^| findstr /r "^[^H]"') do `
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /V Path /t REG_EXPAND_SZ /f /d "%c;C:\Program Files\winget-cli;C:\Program Files\Vim\vim82"
RUN winget install --silent git
ENTRYPOINT ["cmd.exe"]
gives
but you can see it trivially by running winget normally and simply piping the output to a file - the progress and spinner widgets don't check whether VT is enabled when they set their styles.
Activity
JohnMcPMS commentedon Dec 10, 2020
I'm not aware of any way to get back to "just before we started" in terms of the console colors, so we reset to whatever the console considers the default state. I don't get the sense that this is what you are describing since your example of a fix does exactly that, but wanting to set expectations.
I'm not seeing this behavior locally. I'm using Windows Terminal (1.4.3243.0) and PowerShell (7.1.0.0), maybe it is related to your console/shell? Which are you using?
dra27 commentedon Dec 16, 2020
This was actually seen in
docker build, for example:gives
but you can see it trivially by running winget normally and simply piping the output to a file - the progress and spinner widgets don't check whether VT is enabled when they set their styles.
jantari commentedon Jul 16, 2025
Could this also be the cause of #5175 ?