Redirect stdout in another thread

☆樱花仙子☆ 提交于 2019-12-06 16:07:51

print is really Predef.print which calls Console.print. Even though you call System.setOut I don't know if that has an impact on Console.print. Try to call Console.setOut or try:

Console.withOut(ps)(GameRunner.main(null))

The other possibility is that by calling GameRunner.main(_) you are not executing anything (as may be it's just returning the function (args: Array[String]) => GameRunner.main(args)?. Should be quick to rule that out.

Edit yep:

scala> object A { def main(args: Array[String]) { println("1") } }
defined module A   
scala> A.main(null)
1
scala> A.main(_)
res1: Array[String] => Unit = <function1>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!