Redirect stdin/stdout in sbt run task

sbt, scala

Solution

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.

Problem

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 ```

Original source