Different behavior with running psexec from WPF app when executing from command line vs. double-click
I am using process.Start to execute psexec which executes an msi remotely.
For some reason, process.StandardOutput.ReadToEnd() hangs when I double-clicked on the a开发者_如何学Gopplication, but when I execute the WPF app from a command prompt it is fine.
Anybody have any ideas?
Thanks.
I believe you are blocking on the synchronous ReadToEnd call. You might want to use Process.BeginOutputReadLine instead because it's asynchronous: http://msdn.microsoft.com/en-us/library/system.diagnostics.process.beginoutputreadline.aspx
精彩评论