Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ant - Execute commands inside another EXEC environment

 
Ad Pasha
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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>
 
Roger Sterling
Ranch Hand
Posts: 426
Eclipse IDE Fedora Linux
  • Mark post as helpful
  • send pies
  • 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
  • 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:


 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic