jamesmanning/RunProcessAsTask

Getting stdout/err from a cancelled process

Closed this issue · 2 comments

I have read #21 and understood that you don't want to become a second CliWrap, but would you consider exposing the stdout/err from a canceled process as within your scope?

RunProcessAsTask is exactly what I need (so I really would like to stick with it), except that I have to log the output of all tasks, cancelled or not.

@Trolldemorted interesting, I never thought about trying to preserve anything from a cancelled process. 🤔 Unfortunately it'd be quite a breaking change AFAICT since the task returned from ProcessEx.RunAsync will throw with TaskCanceledException (so await would throw that).

https://github.com/jamesmanning/RunProcessAsTask/blob/master/src/RunProcessAsTask.Tests/ProcessExTests.cs#L143-L146

I want to keep the semantics of "process as task" which includes the "throw TaskCanceledException if cancelled", but in terms of your use case it might be simpler to fork the project or just copy and modify it - RunAsync's only about 60 lines currently.

Not the answer you were hoping for, I realize, but between it being a breaking change and the amount of code I think it'd take to support that, I'd rather avoid it if possible. 😞