| Author |
Ant task failed due to confirmation prompt
|
T. Anthony Chen
Ranch Hand
Joined: Jul 28, 2004
Posts: 38
|
|
I have an Exec task that runs a command which, depending on the situation at runtime, may prompt for user confirmation. Running the command alone, the user can choose to type Y or N, the default is N. Running from Ant, the task always fails if the prompt happens. I am guessing that is because a carriage return, which means N to the prompt, is always fed to it. But what I really want to give it is an Y. Is there a way to feed a key stroke to the command when it is executed by Ant? Thanks.
|
T. Anthony Chen<br />---------------<br />SCJP, SCJD, SCBCD, SCWCD, SCEA
|
 |
Dmitry Melnik
Ranch Hand
Joined: Dec 18, 2003
Posts: 328
|
|
In Windows most shell commands have an option to be executed in a "quiet" mode, without confirmation prompts. You can find out the specific syntax for such commands by entereing "help {your command}" in a console window. There is also a way to redirect console input for a command to a text file with answers. Here is an example "xcopy foo.txt bar <yes.txt" Where the file yes.txt contains yes-answer(s) I guess, similar techniques could be used with Unix shells, with a slightly different syntax.
|
 |
T. Anthony Chen
Ranch Hand
Joined: Jul 28, 2004
Posts: 38
|
|
|
Dmitry, I went for your second approach and it worked! Many thanks!
|
 |
 |
|
|
subject: Ant task failed due to confirmation prompt
|
|
|