ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Perevalov" <>
Subject RE: keyboard I/O and Ant 1.4
Date Thu, 08 Nov 2001 15:15:40 GMT
I had same problem, but from <script> task using JavaScript.
The only way I found to access keyboard is to open file "con".
It works for me on Win2000.

Here is a piece of code on JavaScript:

<script language="javascript"> <![CDATA[
  //get standart input stream
  var stdin = new BufferedReader(new InputStreamReader(new
  System.out.println("Please enter password:");
  temp = stdin.readLine();

Paul Perevalov

-----Original Message-----
From: Michael Starkie []
Sent: Thursday, November 08, 2001 9:53 AM
Subject: keyboard I/O and Ant 1.4

Ant version: 1.4

I have a block of java code of which I execute using the "Java" task which
attemps to read input from the keyboad and print the result.  The test works
fine when run outside of ant.  It seems like my keyboard has been cut-off
from my process somewhere even tho I set fork="no".

In the code below I have two print statements; "Before Read" and "After
Read".  The while loop should break when a user hits return.  The while-loop
breaks when run outside of Ant but it does not when called from Ant. Why


    public static String getLine()
        StringBuffer buf = new StringBuffer(80);
        int c;
            System.out.println("Before Read");

            while ( ( c = ) != -1)
                char ch = (char) c;
                if (ch == '\n') break;

            System.out.println("After Read");
        catch ( IOException e)

        return ( buf.toString() );

--== Sent via ==--

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message