can't rely on TERM; use hIsTerminalDevice

This calls an ioctl, I don't think it's very expensive.
This commit is contained in:
Joey Hess 2014-11-18 00:28:46 -04:00
parent d609e47fca
commit e6ff8bfc47
1 changed files with 1 additions and 2 deletions

View File

@ -6,7 +6,6 @@ import System.Console.ANSI
import System.IO
import System.Log.Logger
import "mtl" Control.Monad.Reader
import Data.Maybe
import Control.Applicative
import Propellor.Types
@ -18,7 +17,7 @@ data MessageHandle
| TextMessageHandle
mkMessageHandle :: IO MessageHandle
mkMessageHandle = ifM (isJust <$> getEnv "TERM")
mkMessageHandle = ifM (hIsTerminalDevice stdout)
( return ConsoleMessageHandle
, return TextMessageHandle
)