Really suppress "/dev/tty not configured" message

This commit is contained in:
Alexandre Archambault 2016-03-15 23:55:58 +01:00
parent 5d8ef5fefb
commit f19f9c9a69
1 changed files with 6 additions and 1 deletions

View File

@ -18,7 +18,12 @@ object Terminal {
def consoleDim(s: String): Option[Int] =
if (new File("/dev/tty").exists()) {
import sys.process._
Try(Seq("bash", "-c", s"$pathedTput $s 2> /dev/tty").!!.trim.toInt).toOption
val nullLog = new ProcessLogger {
def out(s: => String): Unit = {}
def err(s: => String): Unit = {}
def buffer[T](f: => T): T = f
}
Try(Process(Seq("bash", "-c", s"$pathedTput $s 2> /dev/tty")).!!(nullLog).trim.toInt).toOption
} else
None