waitforexit

Process waitForExit() doesn't work

亡梦爱人 提交于 2019-12-25 18:19:15
问题 I have the following code: Process p = new Process(); p.StartInfo.FileName = Path.GetDirectoryName(Application.ExecutablePath) + "\\unRAR.exe"; p.StartInfo.Arguments = @"e c:\appData.rar c:\folderek\"; p.Start(); p.WaitForExit(9000); I would like the window not to close after extracting files ( unRAR.exe extracts them). WaitForExit(9000) seems not to work. I read dozens of sites and still can't find any solution. 回答1: http://msdn.microsoft.com/en-us/library/fb4aw7b8.aspx reading this article

How to use Process.WaitForExit

三世轮回 提交于 2019-12-21 06:22:14
问题 I'm calling a 3rd part app which 'sometimes' works in VB.NET (it's a self-hosted WCF). But sometimes the 3rd party app will hang forever, so I've added a 90-second timer to it. Problem is, how do I know if the thing timed out? Code looks like this: Dim MyProcess as System.Diagnostics.Process = System.Diagnostics.Process.Start(MyInfo) MyProcess.WaitForExit(90000) What I'd like to do is something like this If MyProcess.ExceededTimeout Then MyFunction = False Else MyFunction = True End If Any

How to use Process.WaitForExit

纵饮孤独 提交于 2019-12-21 06:21:08
问题 I'm calling a 3rd part app which 'sometimes' works in VB.NET (it's a self-hosted WCF). But sometimes the 3rd party app will hang forever, so I've added a 90-second timer to it. Problem is, how do I know if the thing timed out? Code looks like this: Dim MyProcess as System.Diagnostics.Process = System.Diagnostics.Process.Start(MyInfo) MyProcess.WaitForExit(90000) What I'd like to do is something like this If MyProcess.ExceededTimeout Then MyFunction = False Else MyFunction = True End If Any

WaitforExit doesn't work correctly

放肆的年华 提交于 2019-12-20 02:45:09
问题 So I have been battling this issue for awhile now and tried many different ways to fix it but cannot. Bascally waht my app does is calls a java file to load an application on a device. While it's loading it's printing it to a richtext box, then I would like to move on to the next file. The problem I am having is that while the first file is being loaded, the 2nd tries to load which cases issues. I have tried the wait for exit but if I do that, then the output data doesn't get written to the

Wait for a remote process to finish in .net

二次信任 提交于 2019-12-06 12:14:46
问题 We all know and love Process.WaitForExit(). Given a pid of a process on a remote machine (created by WMI/psexec), how do I wait for it to end? 回答1: Process.GetProcessById(processId, machineName).WaitForExit(); 回答2: For me Process.GetProcessByID() just didn't work (it claimed it couldn't connect to the machine). This worked: public static bool WaitForProcess(int pid, string machine, TimeSpan timeout) { // busy wait DateTime start = DateTime.Now; while (IsAlive(pid, machine)) { if (start.Add

Wait for a remote process to finish in .net

◇◆丶佛笑我妖孽 提交于 2019-12-04 19:47:54
We all know and love Process.WaitForExit(). Given a pid of a process on a remote machine (created by WMI/psexec), how do I wait for it to end? Kent Boogaart Process.GetProcessById(processId, machineName).WaitForExit(); For me Process.GetProcessByID() just didn't work (it claimed it couldn't connect to the machine). This worked: public static bool WaitForProcess(int pid, string machine, TimeSpan timeout) { // busy wait DateTime start = DateTime.Now; while (IsAlive(pid, machine)) { if (start.Add(timeout).CompareTo(DateTime.Now) <= 0) return false; Thread.Sleep(1000); } return true; } public

WaitforExit doesn't work correctly

风格不统一 提交于 2019-12-01 22:25:40
So I have been battling this issue for awhile now and tried many different ways to fix it but cannot. Bascally waht my app does is calls a java file to load an application on a device. While it's loading it's printing it to a richtext box, then I would like to move on to the next file. The problem I am having is that while the first file is being loaded, the 2nd tries to load which cases issues. I have tried the wait for exit but if I do that, then the output data doesn't get written to the rich text box. Any ideas? private void btnLoad_Click(object sender, EventArgs e) { rchsdtOut.Clear(); /

Correct way to handle standard error and output from a program when spawned via Process class from C#?

徘徊边缘 提交于 2019-12-01 04:21:05
I read the documentation for Process.StandardOutput , which has this quote: A deadlock condition can result if the parent process calls p.WaitForExit before p.StandardOutput.ReadToEnd and the child process writes enough text to fill the redirected stream. So I'm wondering. What is the correct way to do this if I'm also afraid that StandardError could be filled in some scenarios? Do I have to use a loop to alternate reading from standard output and error, to avoid either filling up, or is this simple code enough: string error = proc.StandardError.ReadToEnd(); string output = proc.StandardOutput

Correct way to handle standard error and output from a program when spawned via Process class from C#?

这一生的挚爱 提交于 2019-12-01 02:13:36
问题 I read the documentation for Process.StandardOutput, which has this quote: A deadlock condition can result if the parent process calls p.WaitForExit before p.StandardOutput.ReadToEnd and the child process writes enough text to fill the redirected stream. So I'm wondering. What is the correct way to do this if I'm also afraid that StandardError could be filled in some scenarios? Do I have to use a loop to alternate reading from standard output and error, to avoid either filling up, or is this

Visual C# GUI stops responding when process.WaitForExit(); is used

我是研究僧i 提交于 2019-11-28 14:11:13
I am creating a GUI application using Visual C# 2005 (net framework 2). I use the following code to start a process: Process process = new Process(); process.StartInfo = new ProcessStartInfo("app.exe"); process.StartInfo.WorkingDirectory = ""; process.StartInfo.Arguments = "some arguments"; process.Start(); process.WaitForExit(); I want my application to wait until this process is finished, so I used WaitForExit. But the GUI Windows freezes while app.exe is running. I want it to respond (e.g. press a cancel button), but I don't want the code to continue, because there is another process to