开发者

Tips/tricks/gotchas for using System.Diagnostics.Process and Process.Start [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or 开发者_StackOverflowexpertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 11 years ago.

I've used Process.Start to shell out and call 7zip to archive stuff I've also used it to call ffmpeg to compress video files.

That was a while ago..but I rememeber there was some issue about the pcocess stalling if you don't read off the standardoutput/error. I don't remember everything about it. Does anyone have experience using System.Diagnostics.Process for the purposes of initiating a long running process and waiting for it to finish?

Thanks


If you do not redirect the output it should not be a concern.


If you redirect as I did, using the following to avoid deadlocks. See doumentation for ProcessStartInfo.RedirectStandardOutput at http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.redirectstandardoutput.aspx. My longest session was forty minutes scanning my hard drive with ExifTool.

        _process.Start()

        Dim sXmlOutput As String = _process.StandardOutput.ReadToEnd
        Dim sErrOutput As String = _process.StandardError.ReadToEnd

        _process.WaitForExit()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜