-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Weird progress indicators started appearing in stdout #44610
Comments
This issue talks about some new console logger in .Net9 I still see these characters in the output file if build and run are done in separate steps:
And it happens in both Command Prompt and Powershell terminal |
This seems to be coming from how
But surprisingly, setting Actually, sdk/src/Cli/dotnet/commands/dotnet-run/RunCommand.cs Lines 336 to 339 in 8e29df2
|
The forced TerminalLogger came from #42240. I think |
@KalleOlaviNiemitalo thanks for the investigation :) Seems like this has been raised before and we'll have to live with this for some time after GA :( |
That is for older versions of Windows that don't recognise the control sequences. I assume the fix would be to check the version number. That won't help with redirection. The fix dotnet/msbuild#10678 makes MSBuild configure the Windows console to process control sequences if TerminalLogger is used directly, and restore the original modes later. This also doesn't help with redirected output, where MSBuild should not write the control sequences at all. Although the code checks whether output is redirected, and does not configure the console in that case, it writes the control sequences anyway. |
A low-risk fix would be to make dotnet-run check whether output has been redirected, and not add the TerminalLogger in that case; instead add a console logger that is configured to output only errors and warnings, and those to stderr rather than stdout. In the longer term, I hope dotnet-run can let MSBuild create the logger objects (based on command-line options, environment variables, and redirection), and then use the same objects across restore/build/run. |
@baronfel is MSBuild planning on some updates here? |
Why have I started seeing the following character sequence (which seems to some progress indicator) whenever I pipe dotnet program output to a file now?
\x1b]9;4;3;\x1b\\\x1b]9;4;0;\x1b\\
Program.cs:
dotnet run > output.txt
output.txt:
The text was updated successfully, but these errors were encountered: