• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Ant task failed due to confirmation prompt

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dmitry, I went for your second approach and it worked! Many thanks!
 
reply
    Bookmark Topic Watch Topic
  • New Topic