diff --git a/notes/0.13.9/history-infinite-loop.markdown b/notes/0.13.9/history-infinite-loop.markdown new file mode 100644 index 000000000..c2ae3eb51 --- /dev/null +++ b/notes/0.13.9/history-infinite-loop.markdown @@ -0,0 +1,3 @@ +### Bug fixes + +- Prevent history command(s) from going into an infinite loop [#1562][1562] by [@PanAeon][@PanAeon] \ No newline at end of file diff --git a/util/complete/src/main/scala/sbt/complete/HistoryCommands.scala b/util/complete/src/main/scala/sbt/complete/HistoryCommands.scala index 762f48c6d..1e124c583 100644 --- a/util/complete/src/main/scala/sbt/complete/HistoryCommands.scala +++ b/util/complete/src/main/scala/sbt/complete/HistoryCommands.scala @@ -61,7 +61,7 @@ object HistoryCommands { def execute(f: History => Option[String]): History => Option[List[String]] = (h: History) => { - val command = f(h) + val command = f(h).filterNot(_.startsWith(Start)) val lines = h.lines.toArray command.foreach(lines(lines.length - 1) = _) h.path foreach { h => IO.writeLines(h, lines) }