467,188 Members | 1,484 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,188 developers. It's quick & easy.

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
  • viewed: 7946
Share:
1 Reply
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Christian Billig | last post: by
6 posts views Thread by jcrouse | last post: by
7 posts views Thread by Bob | last post: by
9 posts views Thread by Eran.Yasso@gmail.com | last post: by
5 posts views Thread by andrew | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.