Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect stdin/stdout in sbt run task

Tags:

scala

sbt

Is there any way to redirect stdin/stdout for the sbt run task? I can do it from the Bash shell like this:

sbt run < myfile.txt

But not from the sbt console. This doesn't work, for instance:

> run < myfile.txt
like image 937
Paul Butcher Avatar asked Nov 17 '12 11:11

Paul Butcher


1 Answers

You can write a custom runWithInput task which does this for you by running a new JVM process with the input redirected from an argument file. See https://github.com/harrah/xsbt/wiki/Process and https://github.com/harrah/xsbt/wiki/Getting-Started-Custom-Settings.

like image 130
axel22 Avatar answered Sep 23 '22 18:09

axel22