diff options
| author | Joey Hess <joey@kitenet.net> | 2014-11-18 00:41:06 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-11-18 00:42:12 -0400 |
| commit | 1a906048511cf606b15d28c2f151ef8e1d848a50 (patch) | |
| tree | 679285c5c0aed91f98bef0000c44b04228219fe2 /src | |
| parent | 194785b556b2712f5e56672d8915fb939de6e59a (diff) | |
ssh won't allocate a tty; work around
stdin is not a terminal, drat ssh
I don't much like this workaround
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/CmdLine.hs | 4 | ||||
| -rw-r--r-- | src/Propellor/Message.hs | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/Propellor/CmdLine.hs b/src/Propellor/CmdLine.hs index d6c85c08..21c4d95e 100644 --- a/src/Propellor/CmdLine.hs +++ b/src/Propellor/CmdLine.hs @@ -189,7 +189,7 @@ spin hn hst = do where hostprivdata = show . filterPrivData hst <$> decryptPrivData - go cacheparams url privdata = withBothHandles createProcessSuccess (proc "ssh" $ cacheparams ++ ["-t", user, bootstrapcmd]) $ \(toh, fromh) -> do + go cacheparams url privdata = withBothHandles createProcessSuccess (proc "ssh" $ cacheparams ++ [user, bootstrapcmd]) $ \(toh, fromh) -> do let finish = do senddata toh "privdata" privDataMarker privdata hClose toh @@ -303,6 +303,7 @@ boot h = do makePrivDataDir maybe noop (writeFileProtected privDataLocal) $ fromMarked privDataMarker reply + forceConsoleMode mainProperties h getUrl :: IO String @@ -364,4 +365,3 @@ sshCachingParams hn = do [ Param "localhost" ] nukeFile f tenminutes = 600 -sshCachingParams hn = return [] diff --git a/src/Propellor/Message.hs b/src/Propellor/Message.hs index e184a59e..3671e05b 100644 --- a/src/Propellor/Message.hs +++ b/src/Propellor/Message.hs @@ -6,20 +6,26 @@ import System.Console.ANSI import System.IO import System.Log.Logger import "mtl" Control.Monad.Reader +import Control.Applicative +import Data.Maybe import Propellor.Types import Utility.Monad +import Utility.Env data MessageHandle = ConsoleMessageHandle | TextMessageHandle mkMessageHandle :: IO MessageHandle -mkMessageHandle = ifM (hIsTerminalDevice stdout) +mkMessageHandle = ifM (hIsTerminalDevice stdout <||> (isJust <$> getEnv "TERM")) ( return ConsoleMessageHandle , return TextMessageHandle ) +forceConsoleMode :: IO () +forceConsoleMode = void $ setEnv "TERM" "vt100" False + whenConsole :: MessageHandle -> IO () -> IO () whenConsole ConsoleMessageHandle a = a whenConsole _ _ = return () |
