-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Using Console.SetOut doesn't affect IsOutputRedirected #17959
Comments
IsOutputRedirected looks at the output/input/error handles themselves. SetOut doesn't affect those, so Is*Redirected is unaffected by SetOut/SetIn/SetError. SetOut only modifies the TextWriter that the Console operations call e.g. if you do a manual interop write to the stdout handle it will function the same regardless of what SetOut is set to. The Unix behavior was made to mimic the Windows behavior in this regard. |
Yeah I can see that. I'm saying its not great behavior, you are operating on the "Console" object when calling It would be great to have a way of seeing if |
👀 |
We need formal API proposal. |
Does anyone want to take this and submit a formal API proposal with samples and use cases? If not, I'm going to close the issue as there hasn't been any movement in a while. |
@BrennanConroy could you update the impact of this? (and what workaround did we use?) @ianhays please do not close just yet. IIRC, an ASP.NET scenario was impacted with this... |
We wanted a way to check if |
I think we are good to close this. At this point we have enough other mitigations to the root problems in place that it isn't important enough for us to try and make a change at this level of the stack. |
... similarly for Input and Error.
See : https://github.com/dotnet/corefx/blob/5e36ca02d2594f715da829aafaf7af2b554dfcdf/src/System.Console/src/System/ConsolePal.Unix.cs#L461-L467
The summary describes the behavior I expect which is checking
Console.Out
but the actual behavior is checkingSTDOUT
@stephentoub @ianhays
The text was updated successfully, but these errors were encountered: