Questions tagged [waitforexit]
43 questions
7
votes
2 answers
Correct way to handle standard error and output from a program when spawned via Process class from C#?
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…

Lasse V. Karlsen
- 380,855
- 102
- 628
- 825
3
votes
4 answers
WaitforExit doesn't work correctly
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…

user1158745
- 2,402
- 9
- 41
- 60
3
votes
6 answers
Visual C# GUI stops responding when process.WaitForExit(); is used
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 =…
user197967
2
votes
3 answers
How to use Process.WaitForExit
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…
user724198
2
votes
3 answers
Wait for a remote process to finish in .net
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?

ripper234
- 222,824
- 274
- 634
- 905
2
votes
2 answers
WaitForExit() activates on UAC or Security Warning
I'm fairly new to c# and this forum in general but as far as I'm concerned, I haven't seen any question like mine that will solve my problem.
I'm calling the method Process.WaitForExit() to wait until an installation file finishes to install.…

user2595220
- 53
- 1
- 1
- 4
1
vote
0 answers
WaitForExit for programs of type MS Word - process already started
In my app I want to open *.rtf file, and than wait for it to be closed. Often user has MS Word to open *.rtf files and here is the problem. Code below works, but only when "WINWORD" process has not been started yet. When it is, calling…

Jakub Baran
- 11
- 3
1
vote
2 answers
Running Process which take a long time
I have a section in my code where I call a batch file and give it certain arguments. This batch file calls another batch file and so on. The entire process takes about 45 minutes to complete. I also need to wait for the batch file to finish before I…

cwar
- 11
- 1
- 2
1
vote
0 answers
C# process.WaitForExit() not wainting (console application)
I have the following application in C#. What I was expecting was that it would open calc.exe, wait for me to close it manually (console would hang), and then it would finally exit. But it opens calc.exe and exits (while calc is still open). What am…

Adriano_Pinaffo
- 1,429
- 4
- 23
- 46
1
vote
1 answer
Process.Start wait for excel to exit error
Here is my code:
Dim sTemplateSharedPath As String = sSharedDrive & ":\Excel Templates\ImportTemplate.xlsx"
Dim objProcess As System.Diagnostics.Process
Try
objProcess = New…

J2H656
- 101
- 1
- 16
1
vote
1 answer
WaitForExit not timing out correctly, just hangs
I have some code like this:
process.CloseMainWindow();
if (!process.WaitForExit(5000)) { process.Kill(); }
The idea is to let the process exit gracefully, but if it takes longer than 5 seconds, I assume it needs to be killed.
This appears to work…

Starfleet Security
- 1,813
- 3
- 25
- 31
1
vote
1 answer
Timeout elapsed? by WaitForExit
How do I know if the time limit has expired or the process was terminated by the user?
Process p = Process.Start(this.EmergencyApp, npLang);
p.WaitForExit(this.Timeout);

peter70
- 1,053
- 16
- 31
1
vote
0 answers
Process isnt finishing even when using WaitForExit()
I have a method which starts a process. The process is a ruby script which queries an external source and returns something which is printed to a text file 'output.txt' and placed in the directory.
During execution, I run that method which looks…

Josh Bibb
- 477
- 4
- 14
1
vote
1 answer
What Would Cause A Form To Freeze Upon Executing Code
I'm trying to figure why my form freezes up when executing some code. I also can't minimize or move the form. Is it because of the WaitForExit being used in the process?
The below code is tied to a button click.
If Checkbox1.checked = True Then
…

Muhnamana
- 1,014
- 13
- 34
- 57
1
vote
2 answers
WaitForExit default browser
I'm using this code:
Process p = new Process();
ProcessStartInfo si = new ProcessStartInfo();
si.UseShellExecute = true;
si.FileName = Url;
p = Process.Start(si);
p.WaitForExit();
To open the "Url" in the default browser. I want to wait for the…

Valentin Radu
- 629
- 1
- 11
- 26