mirror of https://github.com/sbt/sbt.git
Avoid possible divide by zero
On the off chance that in some configurations the terminal width is set to zero, avoid an exception by returning 0 for terminal lines. It is likely that supershell will not work well if terminal width is zero, but that's better than a potential crash (I think the crash would be in the progress background thread, so I'm not sure how bad it would be, but still its good to avoid).
This commit is contained in:
parent
5cfab4c9a9
commit
9c2dd05b6a
|
|
@ -389,7 +389,7 @@ class ConsoleAppender private[ConsoleAppender] (
|
|||
out.flush()
|
||||
}
|
||||
private def terminalLines(width: Int): String => Int =
|
||||
(progressLine: String) => (progressLine.length - 1) / width
|
||||
(progressLine: String) => if (width > 0) (progressLine.length - 1) / width else 0
|
||||
private def deleteConsoleLines(n: Int): Unit = {
|
||||
(1 to n) foreach { _ =>
|
||||
out.println(DeleteLine)
|
||||
|
|
|
|||
Loading…
Reference in New Issue