Passing input to Ant's <exec> task
- by mikek
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?