Merge pull request #201 from alexarchambault/topic/really-suppress-devtty-message

Really suppress "/dev/tty not configured" message
This commit is contained in:
Alexandre Archambault 2016-03-16 20:55:38 +01:00
commit d8a5e1eedb
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