• Post Reply Bookmark Topic Watch Topic
  • New Topic

Question on process timing out - how to handle?  RSS feed

 
Liz Burke-Scovill
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hope this is the right topic for this.

Quick scenario. I have a class method that runs bat files. In the bat file, is a call to the java compiler. If the bat file runs successfully it indicates success and dumps the screen response into a StringBuffer.

If it fails, it indicates that it failed and does the same thing.

I can get it to run successfully, so I know the success message works just fine. When I intentionally tried to break it (ie., changed the name of the file to be compiled to something that is nonexistant) to test the failure message, instead of returning a failure message, it hung - I even let it run all night (had to go to bed anyway).

Is there a way to poll to see if the process is hung and then cancel it?

Thanks in advance.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you reading the stdout and errout streams from the process you started? Some processes will hang if you are not reading the streams. Search the IO & streams forum for "StreamGobbler" for some other discussions on this.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!