You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Grzegorz SÅ‚owikowski <gs...@gmail.com> on 2013/05/15 16:02:45 UTC

Java task - why is redirecting out stream to file not compatible with spawn

Hi

I'm starting a process by configuring and executing Ant Java task from
my software, see:
https://maven-play-plugin.googlecode.com/svn/mavensite/1.0.0-beta5/play-maven-plugin/xref/com/google/code/play/AbstractAntJavaBasedPlayMojo.html
https://maven-play-plugin.googlecode.com/svn/mavensite/1.0.0-beta5/play-maven-plugin/xref/com/google/code/play/AbstractPlayServerMojo.html
https://maven-play-plugin.googlecode.com/svn/mavensite/1.0.0-beta5/play-maven-plugin/xref/com/google/code/play/AbstractPlayStartServerMojo.html

Sometimes I need to redirect output stream to a file when starting
external process. This is configurable,
but by default I start it with spawn flag set. When spawning, I cannot
redirect process'es output stream to a file, Ant does not allow it. I
wonder why.

I found a workaround:
When spawning I set system property telling spawned process to redirect
its output to a file:
https://maven-play-plugin.googlecode.com/svn/mavensite/1.0.0-beta5/play-maven-plugin/xref/com/google/code/play/AbstractPlayStartServerMojo.html#73

In the spawned process:
https://maven-play-plugin.googlecode.com/svn/mavensite/1.0.0-beta5/play-server-booter/xref/com/google/code/play/PlayServerBooter.html#33

I don't like this solution, but it works if everything goes well.

I the spawned process does not start (for example I try to allocate too
much memory with Xmx argument) I cannot tell what went wrong. The reason
is written
to the output stream, but the output stream is not being output anywhere.

Regards

Grzegorz Slowikowski




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