-
Notifications
You must be signed in to change notification settings - Fork 4k
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
csi.exe should emit exception to stderr, not stdout #9791
Conversation
The compiler tools in general though never emit to standard error, always to standard out. Why should CSI be different here? |
Because that's what good citizen console apps generally do. CSI is logically-speaking more than a compiler. It's used for running scripts in addition to compiling them, with compilation being only an intermediate and transparent step. For a pure compiler tool like |
Would also make it consistent with FSI… Without any redirection of
Prints:
With redirection of
Prints just and as one would be expect:
|
Agreed. |
However the right fix is to add catch (Exception e)
{
DisplayException(e);
return false;
} to http://source.roslyn.io/#Microsoft.CodeAnalysis.Scripting/Hosting/CommandLine/CommandLineRunner.cs,181 Then of course tests need to be updated. |
@tmat Right. I can look into that but we agree that the fix would technically be needed in both places? |
Yes. Please file an issue for DisplayException. I think we can accept this PR. |
@tmat So that's exactly what I have done. I added a tee-like writer so the error stream also writes to the output stream in addition to capturing its own text. I updated the tests where necessary to check the error stream content and everything seems to be passing:
Output:
|
Fixed regression introduced by 92999b7: Tests passed locally:
|
Anything keeping from this being merged? |
👍 |
On error,
csi.exe
should dump the exception toSTDERR
, instead ofSTDOUT
as it does currently, and this PR fixes that.Try the following on a 64-bit Windows Command Prompt (tested against csi version 1.1.0.51109):
The normal expectation is that only
NOK
should be displayed andlog.txt
contains the exception text. Instead,log.txt
is empty and one gets the following output on the console:After applying/merging this PR, only
NOK
should appear on the console and the exception text should end up inlog.txt