473,395 Members | 1,502 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Process WaitForExit LongProcess

I have a fairly simple subroutine written in .net that will run an
executable. It creates a process, starts it and then waitforexit
(long time period). It then checks to make sure that the process has
exited. If not the process is killed. The program works fine if the
process completes within 30 seconds. If the process takes longer, it
looks like the process is no longer given any cpu time.

When the executable is robocopy, it works fine as long as the copy
completes within 30 seconds. However if the copy takes longer, it is
like the process is hung.

I also ran the robocopy from the dos prompt for a large directory and
it works fine.

If I run the same robocopy from my subroutine for a large directory it
hangs after 30 seconds.
Is there a parameter that needs to be set to allow for long processes.

Thanks,
Nov 15 '05 #1
1 8436
Never mind. I found the problem. The output and error data was being
piped to a buffer. This buffer was not being read until the process
was completed. If this buffer gets filled before the process
completes, a deadlock occurs. I added the statement,
StandardOutput.ReadToEnd and the same one for StandardError before
calling waitforexit, which took care of the problem.
This feature is documented in MSDN.

rw*****@yahoo.com (mazda_88) wrote in message news:<3b**************************@posting.google. com>...
I have a fairly simple subroutine written in .net that will run an
executable. It creates a process, starts it and then waitforexit
(long time period). It then checks to make sure that the process has
exited. If not the process is killed. The program works fine if the
process completes within 30 seconds. If the process takes longer, it
looks like the process is no longer given any cpu time.

When the executable is robocopy, it works fine as long as the copy
completes within 30 seconds. However if the copy takes longer, it is
like the process is hung.

I also ran the robocopy from the dos prompt for a large directory and
it works fine.

If I run the same robocopy from my subroutine for a large directory it
hangs after 30 seconds.
Is there a parameter that needs to be set to allow for long processes.

Thanks,

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: James Li | last post by:
I have the code below, the first process takes about 10 minutes to finish. But the waitForExit doesn't seem to wait when I debug the program, it go immediately to execute code after the...
4
by: Christian Billig | last post by:
Hi, well i've a problem and i don't know how to solve it. I wrote a function, which starts a Process for a user by using the API CreateProcessWithLogon. Afterwards i want to know if the...
6
by: jcrouse | last post by:
This is kind of a continuation of another thread that was somewhat resolved: Well, the dilemma seems to be this. I want to be able to hide the DOS box AND pause the code until execution is...
2
by: Terry Olsen | last post by:
Using the following code, I get the error "No process is associated with this object" when calling the WinZip.WaitForExit() method. After I click the "Break" or "Continue" button on the dialog,...
7
by: Bob | last post by:
Process.start("Mydoc.doc") starts Word with the file. I need to wait for Word to be closed before more code can execute in my app. How can I do this? Thanks for any help Bob
1
by: Chris | last post by:
Hello, I have a Windows Forms application which has buttons to click to run other programs. One of the applications it must run is a ClickOnce Windows Forms application, so the Application...
9
by: Eran.Yasso | last post by:
Hi, My app starts process. Some times this process exits because of exception. Can my app know if the process exited due to exception or gracefully? In both ways, the exit code of this...
5
by: andrew | last post by:
Hi, I have the following issue with the Thread.Abort(): The main thread creates a worker thread which waits on a process termination. void ThreadProc() { Process proc =...
4
by: Steven De Smet | last post by:
Hello, This is my first post. I searched on the internet for answers but I was unable to solve my problem. So I hope that you guy's can help me with my VB.NET problem I tried to create a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.