我正在尝试使用simplessh库通过SSH运行一系列命令(实际上是学习一些Haskell)。看起来似乎还可以,但是它挂在了runSimpleSSH
这段代码的第二个位置:
module Main where
import Network.SSH.Client.SimpleSSH
main :: IO ()
main = do
s <- runSimpleSSH $ openSession' "localhost" 22 Nothing
case s of
Left e -> print e
Right s -> do
r <- runSimpleSSH $ execCommand s "ls" -- hangs here
case r of
Left e -> print e
Right (Result { resultOut=resultOut, resultErr=resultErr, resultExit=resultExit }) -> print resultExit
我的Haskell代码是否有问题,还是我使用的库有问题?我确定有人可以根据该库公开的类型进行区分。
从未使用过该库,而是查看以下文档openSession
:
打开一个SSH会话。下一步是进行身份验证。
同样来自execCommand
描述:
在会话上发送命令之前,应先进行身份验证。
我认为您的代码通过execCommand
在成功进行身份验证之前进行调用而违反了约定。不确定这是问题所在,但看起来您仍然需要解决此问题。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句