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

Allow RedirectStandardErrorTo StandardOutput #14

Closed
rocky05475 opened this issue Jun 23, 2017 · 6 comments
Closed

Allow RedirectStandardErrorTo StandardOutput #14

rocky05475 opened this issue Jun 23, 2017 · 6 comments
Milestone

Comments

@rocky05475
Copy link

Very useful feature.

@madelson
Copy link
Owner

Hi @rocky05475. Thanks for your interest in the library!

What exactly are you looking for this to do? Make the standard output stream pull from both? Or make both streams print to Console.Out of the invoking process? What should happen if both streams are outputting data simultaneously?

Can you give some additional details, a code snippet of what the feature might look like, and an example use case?

@rocky05475
Copy link
Author

rocky05475 commented Jun 23, 2017 via email

@madelson
Copy link
Owner

@rocky05475 one concern I have is that merging the streams on the .NET side means that the bytes could be arbitrarily interleaved due to concurrency issues.

We could combine things at the text level to ensure that whole lines are preserved, but this would behave weirdly if the program were producing raw butes or not writing output in lines.

Any thoughts on how this could be made to work?

@madelson
Copy link
Owner

@rocky05475 I think a solution for this could be a new function GetOutputAndErrorLines() which returns an IEnumerable<string> of lines from both StandardOutput and StandardError. You can then foreach this IEnumerable as the process is running:

foreach (var line in command.GetOutputAndErrorLines())
{
    // do something with line
}

@rocky05475
Copy link
Author

rocky05475 commented Jun 27, 2017 via email

@madelson
Copy link
Owner

Working on it currently. I'm going to try and wrap a few of these suggested changes into a single new release version.

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

2 participants