• 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 - Execute commands inside another EXEC environment

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ANT: My exec target starts a process, and expects further commands from user at the command prompt. Think of it as starting a server. After it's started, I need to provide further commands to this process such as unpack, deploy, stop, start etc... Could someone please show me an example of how this is typically done in ANT? To make it even more challenging, the process may ask for user inputs.

The set of commands below shows what I am trying to automate:

Unix-Prompt> myProcess
==== Welcome to myProcess ===
> unpack myJar.zip
This will overwrite your current install. Are you sure (y/n)?
y
> deploy myApplication
> stop server
Are you sure (y/n)?
y
> start server
> quit
=== Good Bye ===
Unix-Prompt>
 
Ranch Hand
Posts: 426
Eclipse IDE Fedora Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure what you are asking, as the documentation is fairly specific about how to redirect stdin or stdout.

Is there something in the documentation that is confusing for you ?

I/O redirection wrote: input A file from which the executed command's standard input is taken. This attribute is mutually exclusive with the inputstring attribute.

 
Ad Pasha
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you mean that the code below will have the same effect as running the unpack, start, stop... commands within the "myProcess" runtime?


where, in.txt has:


 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, that it correct. You can verify this with a simple Java app that gets input from stdin and echos that input.
 
Ad Pasha
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unfortunately, the "Are you sure?" prompts are difficult to answer / bypass. The "y"s in the in.txt are interpreted as separate commands, rather than inputs to the prompts. The in.txt approach helps me execute multiple commands in exec (in my case, sshexec), but doesn't help with the prompts
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic