Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ant exec task: How can I read input from console stdin?

I have a call to Ant exec task that needs to accept input from console stdin. Unfortunately, I cannot find a way to do this. The stdin filehandle seems closed to console input at runtime.

It is possible to specify input using attributes input and inputstring. However, I need to prompt for user input at the console.

How can I do this?

like image 224
kevinarpe Avatar asked Nov 05 '22 06:11

kevinarpe


1 Answers

From the documentation of the task:

Note that you cannot interact with the forked program, the only way to send input to it is via the input and inputstring attributes. Also note that since Ant 1.6, any attempt to read input in the forked program will receive an EOF (-1). This is a change from Ant 1.5, where such an attempt would block.

You could try to use the input-task to prompt for input in the ant-buildfile and pass these input with the inputstring-attribute of exec. I can't think of a better option at the moment.

like image 118
Mnementh Avatar answered Nov 11 '22 13:11

Mnementh