Closed fgheorghe closed 6 years ago
send a CTRL+C instruction to the socket. I'm not sure how to do that but you can just send a CTRL+C instruction to end it.
Also you can just close the socket connection. Maybe there's a socket.close()
command.
Thank you for your reply - sometimes when i close the socket, the command won't stop. Will try sending a CTRL+C instruction instead.
People are saying that \x003
or \x03
is a CTRL+C instruction btw.
Please pass {pty: true} as second parameter when spawning a tail command. Before closing, pass SIGKILL command via socket.
Thank you all.
The following appears to have worked: Setting the pty to true, as per @sanketbajoria suggestion. Sending a \x03 before closing the connection.
Great community! Will close this "issue" now.
How do i stop a command, i.e.: tail: //use spawn, if you want to stream on output of command (async function(){ var socket = await ssh.spawn("tail -f /var/log.txt"); socket.on('data', () => { //file content will be available here }) })();
Basically, I would like to kill the tail command when terminating a connection.
Thank you