Re: Issue implementing Runtime.exec() with StreamGobbler
- From: Vic <vikrantp@xxxxxxxxx>
- Date: Fri, 6 Mar 2009 11:04:18 -0800 (PST)
On Mar 6, 10:40 am, "Matt Humphrey" <ma...@xxxxxxxx> wrote:
"Vic" <vikra...@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 dieThanks for the reply. it doesn't throw any exception or anything just
errorGobbler.join();
outputGobbler.join();
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 Humphreyhttp://www.iviz.com/
Let me try moving the
stdout = outputGobbler.getResult();
stderr = errorGobbler.getResult();
after the threads have finished.
I just checked and there was no try catch around
NewCommandExecuter xmlOut = new NewCommandExecuter(xmlOutCmd);
so I've put that now and will try to rerun the automation and see if
what I get. I'll give an update soon. Thanks for your reply
.
- 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
- Re: Issue implementing Runtime.exec() with StreamGobbler
- From: Matt Humphrey
- Issue implementing Runtime.exec() with StreamGobbler
- Prev by Date: Re: shoes on
- Next by Date: Re: Beep
- Previous by thread: Re: Issue implementing Runtime.exec() with StreamGobbler
- Next by thread: Re: Issue implementing Runtime.exec() with StreamGobbler
- Index(es):
Relevant Pages
|