home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 2
Plugin Development
Featured Plugins
UPnP / DLNA Media Server
UPnP / DLNA Media Server for MediaPortal 2
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="MJGraf" data-source="post: 1153007" data-attributes="member: 17886"><p>[USER=106003]@FreakyJ[/USER] </p><p>Thanks for asking - and sorry for only a short answer as I don't have much time currently...</p><p></p><p>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.</p><p></p><p>The reasons why it is a bit "hacky" are mainly two:</p><ul> <li data-xf-list-type="ul">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.</li> <li data-xf-list-type="ul">The Process class often leads to dead-locks when you want to read the standard-output and -error streams.</li> </ul><p>As to aborting the process, we currently only have a timeout value that terminates the process automatically when the timeout is reached. Following the TAP pattern I could well imagine that we have an overload of the method that accepts a CancellationToken instead of a timeout. That way you can terminate the process via the CancellationToken. I could even imagine that we move the main part of the code to the method with the CancellationToken parameter and let the overload with the timeout just call the first one with a cancellationToken that cancels automatically when the timeout is reached.</p><p></p><p>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).</p><p>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...</p><p>I'll think about that one a bit - maybe I have some more ideas...</p></blockquote><p></p>
[QUOTE="MJGraf, post: 1153007, member: 17886"] [USER=106003]@FreakyJ[/USER] 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: [LIST] [*]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. [/LIST] As to aborting the process, we currently only have a timeout value that terminates the process automatically when the timeout is reached. Following the TAP pattern I could well imagine that we have an overload of the method that accepts a CancellationToken instead of a timeout. That way you can terminate the process via the CancellationToken. I could even imagine that we move the main part of the code to the method with the CancellationToken parameter and let the overload with the timeout just call the first one with a cancellationToken that cancels automatically when the timeout is reached. 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... [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 2
Plugin Development
Featured Plugins
UPnP / DLNA Media Server
UPnP / DLNA Media Server for MediaPortal 2
Contact us
RSS
Top
Bottom