You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Zsolt Koppany <zk...@web.de> on 2003/02/08 19:52:33 UTC

How to execute a command that reads from stdin

Hi,

how can I execute a task from Ant that has to read from the stdin? I
mean like in shell "cat < in.lst". I have to start a program that
unfortunately does not understand a flag with a filename to read from.
-- 
Zsolt


Re: How to execute a command that reads from stdin

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
Zsolt Koppany wrote:
> Hi,
> 
> how can I execute a task from Ant that has to read from the stdin? I
> mean like in shell "cat < in.lst". I have to start a program that
> unfortunately does not understand a flag with a filename to read from.

I have just added the capability to the <exec> and <java> tasks to redirect 
input

<exec ... input="in.lst"/>

This will be part of Ant 1.6 - you can try it out from CVS or a nightly 
build. Of course prior to a 1.6 release, these features are subject to 
further development and change.

In the current version of Ant, you can execute a shell and redirect input in 
the command you give that shell. This example from Bug 3452 (Thanks David)

   <exec executable="cmd" os="Windows 2000" output="log.txt">
     <arg line="/c mysql &lt; init_db.sql>
   </exec>
   <exec executable="/bin/sh" os="Linux" output="log.txt">
     <arg line="-c mysql &lt; init_db.sql>
   </exec>

Conor


Re: How to execute a command that reads from stdin

Posted by Martin <mg...@hotmail.com>.
Zsolt-

use javascript to read from STDIN
<script language="javascript"> <![CDATA[
read(STDIN, $StringBuffer, $ENV{'CONTENT_LENGTH'})
]]> </script>

werden Sie daraus klug?
-Martin

----- Original Message ----- 
From: "Zsolt Koppany" <zk...@web.de>
To: <an...@jakarta.apache.org>
Sent: Saturday, February 08, 2003 2:52 PM
Subject: How to execute a command that reads from stdin


> Hi,
> 
> how can I execute a task from Ant that has to read from the stdin? I
> mean like in shell "cat < in.lst". I have to start a program that
> unfortunately does not understand a flag with a filename to read from.
> -- 
> Zsolt
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ant-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: ant-user-help@jakarta.apache.org
> 

Re: How to execute a command that reads from stdin

Posted by John Guthrie <jg...@psynapsetech.net>.
if you look at the archives, someone came up with a task to do this for java
tasks a while back called InOutJava (my apologies to said someone for not
giving him due credit). the problem was that you could not fork a new jvm
with this task. i was playing with this myself, and, still in java,  i
figured this can easily be done using aspectj, with or without forking. not
that i *have* done it yet.

john

----- Original Message -----
From: "Zsolt Koppany" <zk...@web.de>
To: <an...@jakarta.apache.org>
Sent: Saturday, February 08, 2003 1:52 PM
Subject: How to execute a command that reads from stdin


> Hi,
>
> how can I execute a task from Ant that has to read from the stdin? I
> mean like in shell "cat < in.lst". I have to start a program that
> unfortunately does not understand a flag with a filename to read from.
> --
> Zsolt
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ant-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: ant-user-help@jakarta.apache.org
>