Skip to content
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

Change IConsole to ConsoleStreams or equivalent #1786

Closed
jonsequitur opened this issue Jun 30, 2022 · 3 comments
Closed

Change IConsole to ConsoleStreams or equivalent #1786

jonsequitur opened this issue Jun 30, 2022 · 3 comments

Comments

@jonsequitur
Copy link
Contributor

Because IConsole was in part intended to explore future potential ideas for System.Console which will require a longer design period, we should change this interface to a concrete type with a more focused scope.

A suggestion made by @terrajobst in API review looked roughly like this:

public class ConsoleStreams
{
    public TextWriter StandardOutput { get; }
    public TextWriter StandardError { get; }
    public TextReader StandardInput { get; }
}
@KalleOlaviNiemitalo
Copy link

KalleOlaviNiemitalo commented Jul 1, 2022

For piping binary data as described in #1782 (comment), I'd also like

public Stream OpenStandardInput();
public Stream OpenStandardOutput();
public bool IsInputRedirected { get; }
public bool IsOutputRedirected { get; }

I don't use binary I/O on StandardError, though.

@jonsequitur
Copy link
Contributor Author

These changes would be out of scope for the purpose of this issue (although simpler handling of piped input is something we'd like to look at after the 2.0 GA). It's possible we'll leave input out as well since by default, attempting to read from it will likely result in a blocking and non-cancellable call.

I'd encourage you to add your thoughts to this discussion: dotnet/runtime#52374. Until some of these design concerns are resolved, it's unlikely we'll try to address them in System.CommandLine.

@adamsitnik
Copy link
Member

fixed by #2106

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants