开发者

persistent local tty session with java

开发者 https://www.devze.com 2023-01-09 13:12 出处:网络
I`m developing a web shell client, with tab functionality \"code completion\" and a have a question. Anyone know a way to open a local tty persistent connection where I can to execute multiple command

I`m developing a web shell client, with tab functionality "code completion" and a have a question. Anyone know a way to open a local tty persistent connection where I can to execute multiple commands with one session, i wont like to exec all time Runtime开发者_JS百科.getRuntime().exec("command"); Any suggestion? Regards


Instead of Runtime.getRuntime().exec("command"); do Runtime.getRuntime().exec("/bin/sh"); and hold on to the Process object. Then you can write commands to the OutputStream provided by its getOutputStream() method - I presume you're already getting the output by reading its InputStream.

0

精彩评论

暂无评论...
验证码 换一张
取 消