node.js - sending key-shortcuts to child process

北城以北 提交于 2019-12-05 07:53:00

With a normal ssh session, sending '~' after a newline is the escape character to control the ssh program itself. For example '~.' will close the connection.

Search for 'tilde' on the manpage.

Update:

On re-reading your question, I think you are probably wanting to send Ctrl-* to the remote process running in the ssh session rather than talking to the ssh process itself. You might just be able to send the ASCII sequence that the Ctrl key would generate:

sshprocess.stdin.write("\x03")

ASCII character 0x03 is what Ctrl-C becomes. This is from the ancient days of dumb terminals. More about ASCII control sequences.

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