I'm trying to have a node.js eval piped to a ssh2 stream. And I'm having some interesting issues. Mainly how either ssh2 or ssh clients interpret the data. Let's take a look.
when you run the node process, you get this nice prompt
where sshStream is a ssh2 stream, now because I'm piping the stream, this is how it looks on the other side:
basically the cursor is moving down below, and not staying where it used to, if I type s, then it doesn't get fixed, and the terminal gets even more messed up, does anyone know the causes? How should I fix this?
fixNewLines
is basically a pipe that replaces ('\n' into '\r\n' because apparently, that's important for the ssh protocol, otherwise you don't get the desired behaviour)