我使用scala-ssh 0.7.0从远程服务器下载文件。
下载本身似乎成功(我可以找到下载的文件)。这是日志输出的最后一部分:
16:14:43.824 [主要] TRACE net.schmizz.sshj.xfer.LoggingTransferListener - 转移100%
log-file.txt
16:14:43.824 [主要]信息 net.schmizz.sshj.common.StreamCopier - 44.82421875 KiB转入 1.572秒(28.514134064885496 KiB / s)16:14:43.825 [main] DEBUG net.schmizz.sshj.xfer.scp.SCPEngine - 远程同意转移完成 16:14:43.826 [主要] DEBUG net.schmizz.sshj.xfer.scp.SCPEngine - 信令:转移完成16:14:43.826 [主要] TRACE net.schmizz.sshj.transport.Encoder - 编码数据包#10:5e 00 00 00 00 00 00 00 01 00 16:14:43.826 [主要] DEBUG net.schmizz.sshj.connection.channel.Window $ Remote - 消耗1 至2097148 16:14:44.220 [读者] TRACE net.schmizz.sshj.transport.Decoder - 收到的数据包#14:62 00 00 00 00 00 00 00 0b 65 78 69 74 2d 73 74 61 74 75 73 00 00 00 00 00 16:14:44.221 [读者] TRACE net.schmizz.sshj.transport.TransportImpl - 收到的数据包CHANNEL_REQUEST 16:14:44.221 [reader] DEBUG net.schmizz.sshj.connection.channel.direct.SessionChannel - Got chan 请求exit-status
16:14:44.222 [读者] TRACE net.schmizz.sshj.transport.Decoder - 收到的数据包#15:60 00 00 00 00 16:14:44.222 [读者] TRACE net.schmizz.sshj.transport.TransportImpl - 收到的数据包 CHANNEL_EOF 16:14:44.222 [读者] DEBUG net.schmizz.sshj.connection.channel.direct.SessionChannel - 得到了EOF 16:14:44.223 [读者] TRACE net.schmizz.sshj.transport.Decoder - 收到的数据包#16:61 00 00 00 00 16:14:44.223 [读者] TRACE net.schmizz.sshj.transport.TransportImpl - 收到的数据包 CHANNEL_CLOSE 16:14:44.223 [主要] DEBUG net.schmizz.sshj.connection.channel.direct.SessionChannel - 发送 关闭16:14:44.223 [读者] DEBUG net.schmizz.sshj.connection.channel.direct.SessionChannel - 近在咫尺 16:14:44.224 [main] TRACE net.schmizz.sshj.transport.Encoder - 编码包#11:61 00 00 00 00 16:14:44.225 [主] DEBUG net.schmizz.concurrent.Promise - 等待<> 16:14:44.225 [读者] DEBUG net.schmizz.sshj.connection.ConnectionImpl - 忘记session
频道(#0) 16:14:44.225 [读者] DEBUG net.schmizz.concurrent.Promise - 设置<>到SOME
我的代码非常简单:
import com.decodified.scalassh._
val sshClient = new SshClient(new HostConfig(login = PasswordLogin(userName, SimplePasswordProducer(password)), hostName))
sshClient.download(filePath, targetDirectory)
现在,虽然下载成功完成,并且在下载命令后应用程序继续执行,但应用程序本身并不退出。
有什么想法吗?
答案 0 :(得分:0)
对RichSshClient的隐式转换似乎落后于此。 我通过创建一个新类避免了对RichSshClient的隐式转换 - ' SshClientEnhanced'它使用ScpTransferable扩展SshClient。在SshClientEnhanced实例上调用下载方法可以正常工作。