ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gregsmit <gregs...@us.ibm.com>
Subject How does ant do exec "spawn=true" ?
Date Sat, 08 Mar 2008 01:06:56 GMT


Hi,

This is less of a question about Ant, than it is a question "How do they do
that??"

Ant has the ability to spawn a new process, where all of the output of the
new process goes in the bit bucket, and the original Java process can go
away.  The spawned process stays running.

The reason I'm wondering how this works is -- I've always had problems
before with Runtime.exec() that if I didn't grab the new process' output
streams and consume everything off of them, then the exec'ed process would
eventually block on its stdout and stderr.

But Ant seems to have found away to redirect the exec'ed process' stdout and
stderr, so that even when the parent java process goes away, the child
doesn't get blocked.  Without native / JNI code.

How?  Maybe its something new (at least newer than the last time I used
Runtime.exec) in Java 1.5+?

I tried to follow the code, but still didn't quite understand.  It looked
like it created threads to consume the output, but those would go away when
the ant/java process ends.

Thanks,
Greg

-- 
View this message in context: http://www.nabble.com/How-does-ant-do-exec-%22spawn%3Dtrue%22---tp15909817p15909817.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message