Wait for JSch command to execute instead of hard coding a fixed time to wait for

六眼飞鱼酱① 提交于 2019-12-04 20:29:56
gmavrikas

You have to loop reading chunks of the response until channel.isClosed() returns true.

At that point you can call channel.getExitStatus() to get the process exit code and then close the channel.

If you don't want to burn CPU cycles while looping to read the response bytes, put a Thread.sleep(100) between each read.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!