@FreakyJ
Thanks for asking - and sorry for only a short answer as I don't have much time currently...
First of all, I think "ImpersonationService.ExecuteWithResourceAccessAsync" is more similar to what you Need than "ProcessUtils.TryExecuteAsync". The first one supports impersonation, which may be necessary if you want ffmpeg to transcode a video that is accessible through a NetoworkNeighborhoofResourceAccessor pointing to e.g. a NAS for which you need credentials to access it. The code of these two is nearly identical - except for the impersonation.
The reasons why it is a bit "hacky" are mainly two:
As to your second question, this seems more complicated. What these methods currently do is they return a task that completes, when the Process is finished (i.e. exited automatically or terminated after the timeout). Then they return a ProcessExcutionResult that contains anything that was written to stdout and stderr during executing the process (in form of strings).
What you need seems to be a way to read stdout WHILE the process is running. And this is not what these classes and methods were meant for...
I'll think about that one a bit - maybe I have some more ideas...
Thanks for asking - and sorry for only a short answer as I don't have much time currently...
First of all, I think "ImpersonationService.ExecuteWithResourceAccessAsync" is more similar to what you Need than "ProcessUtils.TryExecuteAsync". The first one supports impersonation, which may be necessary if you want ffmpeg to transcode a video that is accessible through a NetoworkNeighborhoofResourceAccessor pointing to e.g. a NAS for which you need credentials to access it. The code of these two is nearly identical - except for the impersonation.
The reasons why it is a bit "hacky" are mainly two:
- The Process class doesn't support starting a process with different credentials. To be able to do so at all, we need to use reflection.
- The Process class often leads to dead-locks when you want to read the standard-output and -error streams.
As to your second question, this seems more complicated. What these methods currently do is they return a task that completes, when the Process is finished (i.e. exited automatically or terminated after the timeout). Then they return a ProcessExcutionResult that contains anything that was written to stdout and stderr during executing the process (in form of strings).
What you need seems to be a way to read stdout WHILE the process is running. And this is not what these classes and methods were meant for...
I'll think about that one a bit - maybe I have some more ideas...