ant-user mailing list archives

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


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

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.


View this message in context:
Sent from the Ant - Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message