【问题标题】:Scala readLine with prompt displays prompt after line input in SBTScala readLine with prompt 在 SBT 中的行输入后显示提示
【发布时间】:2014-03-05 16:26:21
【问题描述】:

我正在从 Windows 7 命令行通过 sbt run 运行 Scala 2.10 程序,并且在使用提示符调用 readLine 重载时看到了意外行为。提示在实际输入行之后显示。

来源

object MyExample extends App {
  readLine("This prompt is shown after the readline!")
}

build.sbt

name := "hello"\n
\n
version := "1.0"\n
\n

输出

asdf
This prompt is shown after the readline!

有什么我不明白的地方还是一个错误?它似乎按照 IDEA 的预期工作。

Sbt 版本:0.13.1

【问题讨论】:

  • 您可以运行sbt about 来了解您的 SBT 版本和插件吗?我遇到了由插件而非 SBT 本身引起的 SBT 问题。

标签: scala sbt


【解决方案1】:

我之前遇到过giter8。解决方法是自己打印,刷新输出流,然后读取。有关解决方法的示例,请参阅 this pull request

Someone has fixed it 大约一个月前在 scala 源中。我不知道我们什么时候会看到这个修复。

【讨论】:

  • 值得一提的是,将scalaVersion := "2.11.0-RC1" 添加到build.sbt 作为解决方案(我无法自己检查,因为我现在无法访问Win7)。
猜你喜欢
  • 1970-01-01
  • 2015-04-18
  • 1970-01-01
  • 2022-01-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多