Passing input to Ant's <exec> task
Posted
by mikek
on Stack Overflow
See other posts from Stack Overflow
or by mikek
Published on 2010-05-06T15:43:02Z
Indexed on
2010/05/06
15:48 UTC
Read the original article
Hit count: 199
ant
I have an Ant script running a standard -task after taking in an inputed password:
<input message="Password:" addproperty="password">
<handler classname="org.apache.tools.ant.input.SecureInputHandler" />
</input>
<exec executable="/bin/sh" input="${password}" failonerror="true">
<arg line='-c "myScript.sh"' />
</exec>
The script myScript.sh prompts the user for a password, and, it was my understanding that from the Ant documentation that input is supposed relay input into whatever the <exec>
task is executing, but instead I get (for entering the password foobar)
[exec] Failed to open /usr/local/foobar
which is followed by a stack trace from my script complaining about an incorrect password...so obviously I've understood the documentation wrong. Does anybody know how to handle prompted input from external scripts in Ant?
© Stack Overflow or respective owner