【发布时间】:2019-07-01 11:44:10
【问题描述】:
我正在尝试执行一个使用“Net::SSH::Expect”模块的 perl 脚本。
我面临的问题是,当我通过 Cygwin 执行脚本时,它就像一个魅力.. 但是当通过 windows CMD 执行相同的脚本时,它会失败并给出以下错误 ->
SSHAuthenticationError Login timed out. The input stream currently has the contents bellow: Pseudo-terminal will not be allocated because stdin is not a terminal.
at /usr/local/share/perl5/site_perl/5.26/Expect.pm line 904.
你能建议我错过了什么吗?
【问题讨论】:
-
EMSIA? Expect FAQ:“Expect 本身没有真正的系统依赖,但底层的 IO::Tty 需要伪终端。IO::Stty 使用 POSIX.pm 和 Fcntl.pm。”然后跟注检查IO::Tty
-
IO::Tty:“现在支持 Windows,但仅在 Cygwin 环境下”。我想这总结了你的问题的答案。
-
您也可以尝试安装最新的 PowerShell Core (PWSH > 6.2),而不是 CMD。 Win10 环境中的 AFAIK PWSH 现在应该可以使用 Pty 的了。但我必须承认,我没有测试过这个。