You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by terrance grahn <tj...@gmail.com> on 2007/10/10 19:29:58 UTC

Running task with an "interactive" executable

I am trying to run an executable; however, I keep getting stumped on one
part.  I am able to run the executable correctly, but there is a point in
this executable that prompts the user for a password (and then asks them to
confirm it again).  I want to send this through the Ant task, but nothing I
use works.

details:

    <target name="createInstance" >

        <!-- simple property to be used which will name the instance (assume
"instance1" is entered) -->
        <input message="Enter the instance name"
addproperty="instanceName"/>

        <!-- calls the 'createinstance.bat' file and provides the input from
the arg line -->
        <exec inputstring="password" dir="d:/oracle/OAS10g/bin"
failonerror="true" executable="cmd" os="Windows XP">
            <arg line="/C createinstance.bat -instanceName
${instanceName}"/>

        </exec>
    </target>



So this reads the arg line well, but it always errors out because nothing is
entered for the password.  Here is the output:

Creating OC4J instance "instance1"...
Set OC4J administrator password for "instance1" (password text will not be
displayed as it is entered):
Error creating new OC4J instance: OC4J administrator's password is null.



I Guess I need to know exactly how 'input' and 'inputstring' attributes can
be used with the exec task - I have not seen any examples anywhere that use
these attributes.