Re: Issue implementing Runtime.exec() with StreamGobbler
- From: "Matt Humphrey" <matth@xxxxxxxx>
- Date: Fri, 6 Mar 2009 13:40:03 -0500
"Vic" <vikrantp@xxxxxxxxx> wrote in message
news:94832ae5-aed7-46cf-8cc2-b51b3d5dd6dc@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Mar 6, 9:56 am, Knute Johnson <nos...@xxxxxxxxxxxxxxxxxxxxxxx>
wrote:
<snip code>
int val = proc.waitFor();
System.out.println("ExitValue for Command "+cmd+" is: "+val);
stdout = outputGobbler.getResult();
stderr = errorGobbler.getResult();
//VikP - Waits for these threads to die
errorGobbler.join();
outputGobbler.join();
Thanks for the reply. it doesn't throw any exception or anything just
ends without running all the tests and its not like the loop gets
terminated at one specific point its random and could be anywhere in
the entire loop. Sometimes it runs 100 cases n will stop whereas
sometimes it'll run 150x cases n will stop there
There is a small opportunity for error in that you are retrieving the stream
gobbler results before the threads have finished. That is, the test process
may have finished, but some output in the pipeline is still being processed
by the stream gobbler. getResult will return null because the results are
not transferred until the reading loop has finished.
The answer to your problem is in the loop code (please show it) because the
call to the executer must either return or throw an exception. What are
the loop exit conditions? What happens to any exceptions (e.g. Xml-out
query... exception) ? What did the JVM do after the loop exited?
Matt Humphrey http://www.iviz.com/
.
- Follow-Ups:
- References:
- Issue implementing Runtime.exec() with StreamGobbler
- From: Vic
- Re: Issue implementing Runtime.exec() with StreamGobbler
- From: Knute Johnson
- Re: Issue implementing Runtime.exec() with StreamGobbler
- From: Vic
- Issue implementing Runtime.exec() with StreamGobbler
- Prev by Date: Re: Get reference to object in Set
- Next by Date: Re: a xml question -- how to use a variable in xml file?
- Previous by thread: Re: Issue implementing Runtime.exec() with StreamGobbler
- Next by thread: Re: Issue implementing Runtime.exec() with StreamGobbler
- Index(es):
Relevant Pages
|