ssh won't allocate a tty; work around

stdin is not a terminal, drat ssh

I don't much like this workaround
This commit is contained in:
Joey Hess 2014-11-18 00:41:06 -04:00
parent 194785b556
commit 1a90604851
2 changed files with 9 additions and 3 deletions

View File

@ -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 []

View File

@ -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 ()