有没有办法为sbt run
任务重定向stdin/stdout ?我可以像这样从Bash shell中做到这一点:
sbt run < myfile.txt
Run Code Online (Sandbox Code Playgroud)
但不是来自sbt控制台.这不起作用,例如:
> run < myfile.txt
Run Code Online (Sandbox Code Playgroud)
您可以编写一个自定义runWithInput
任务,通过使用从参数文件重定向的输入运行新的 JVM 进程来为您执行此操作。请参阅https://github.com/harrah/xsbt/wiki/Process和https://github.com/harrah/xsbt/wiki/Getting-Started-Custom-Settings。