0

I want to do something along the lines of this:

echo "foobar" | ./gradlew run

I understand that the run task calls JavaExec which takes a standardInput argument. But wasn't able to use it via the commandline.

Is it possible pass my piped input stream to the application?

fahrradflucht
  • 1,563
  • 3
  • 14
  • 22

1 Answers1

1

In the run task, set standardInput to be System.in

run {
  standardInput = System.in
}
smac89
  • 39,374
  • 15
  • 132
  • 179
  • 1
    Thanks. Now that I know the answer I found that my question is a duplicate of https://stackoverflow.com/questions/45747112/kotlin-and-gradle-reading-from-stdio which I couldn't find before, since I searched with different keywords. – fahrradflucht Dec 22 '19 at 18:40