Cysharp / ProcessX

Simplify call an external process with the async streams in C# 8.0.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add standard error redirect option

itn3000 opened this issue · comments

Currently(rev: 09f95cb), ProcessX.StartAsync throws error when process output stderr.
This may be unexpected result in apps using stderr as logging or progress.

So I propose adding option to redirecting stderr.
In particular, add System.IO.Stream or System.Buffers.IBufferWriter<byte>(or char?) to ProcessX.StartAsync API

thanks for the proposal.
I've added new api GetDualAsyncEnumerable, and just published in 1.1.0.
https://github.com/Cysharp/ProcessX#raw-processstderror-stream

Is it okay?

This is what I needed, thanks.

Just an idea - a combined async enumerable:

struct ProcessResponse
{
	public ProcessResponse(ProcessResponseSource source, string text)
	{
		Source = source;
		Text = text;
	}

	public ProcessResponseSource Source { get; }
	
	public string Text { get; }
}

public enum ProcessResponseSource
{
	Output,
	Error,
}