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:
parent
194785b556
commit
1a90604851
|
@ -189,7 +189,7 @@ spin hn hst = do
|
||||||
where
|
where
|
||||||
hostprivdata = show . filterPrivData hst <$> decryptPrivData
|
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
|
let finish = do
|
||||||
senddata toh "privdata" privDataMarker privdata
|
senddata toh "privdata" privDataMarker privdata
|
||||||
hClose toh
|
hClose toh
|
||||||
|
@ -303,6 +303,7 @@ boot h = do
|
||||||
makePrivDataDir
|
makePrivDataDir
|
||||||
maybe noop (writeFileProtected privDataLocal) $
|
maybe noop (writeFileProtected privDataLocal) $
|
||||||
fromMarked privDataMarker reply
|
fromMarked privDataMarker reply
|
||||||
|
forceConsoleMode
|
||||||
mainProperties h
|
mainProperties h
|
||||||
|
|
||||||
getUrl :: IO String
|
getUrl :: IO String
|
||||||
|
@ -364,4 +365,3 @@ sshCachingParams hn = do
|
||||||
[ Param "localhost" ]
|
[ Param "localhost" ]
|
||||||
nukeFile f
|
nukeFile f
|
||||||
tenminutes = 600
|
tenminutes = 600
|
||||||
sshCachingParams hn = return []
|
|
||||||
|
|
|
@ -6,20 +6,26 @@ import System.Console.ANSI
|
||||||
import System.IO
|
import System.IO
|
||||||
import System.Log.Logger
|
import System.Log.Logger
|
||||||
import "mtl" Control.Monad.Reader
|
import "mtl" Control.Monad.Reader
|
||||||
|
import Control.Applicative
|
||||||
|
import Data.Maybe
|
||||||
|
|
||||||
import Propellor.Types
|
import Propellor.Types
|
||||||
import Utility.Monad
|
import Utility.Monad
|
||||||
|
import Utility.Env
|
||||||
|
|
||||||
data MessageHandle
|
data MessageHandle
|
||||||
= ConsoleMessageHandle
|
= ConsoleMessageHandle
|
||||||
| TextMessageHandle
|
| TextMessageHandle
|
||||||
|
|
||||||
mkMessageHandle :: IO MessageHandle
|
mkMessageHandle :: IO MessageHandle
|
||||||
mkMessageHandle = ifM (hIsTerminalDevice stdout)
|
mkMessageHandle = ifM (hIsTerminalDevice stdout <||> (isJust <$> getEnv "TERM"))
|
||||||
( return ConsoleMessageHandle
|
( return ConsoleMessageHandle
|
||||||
, return TextMessageHandle
|
, return TextMessageHandle
|
||||||
)
|
)
|
||||||
|
|
||||||
|
forceConsoleMode :: IO ()
|
||||||
|
forceConsoleMode = void $ setEnv "TERM" "vt100" False
|
||||||
|
|
||||||
whenConsole :: MessageHandle -> IO () -> IO ()
|
whenConsole :: MessageHandle -> IO () -> IO ()
|
||||||
whenConsole ConsoleMessageHandle a = a
|
whenConsole ConsoleMessageHandle a = a
|
||||||
whenConsole _ _ = return ()
|
whenConsole _ _ = return ()
|
||||||
|
|
Loading…
Reference in New Issue