Actually, to fake a Ctrl-C command, I just have to send the ETX letter. (Number 3 in ASCII)
Regards, Samuel. Le mardi 08 décembre 2009 à 04:10 +0100, Peter Stuge a écrit : > Samuel ROZE wrote: > > But, if you type "sleep 10;" and then make a Ctrl + C, this will > > print "^C" and then allow you to type another command while > > cancelling this sleep command. > > > > If I send to my ssh2 channel an "sleep 1000;" command for instance, > > how I can send the ^C command ? > > Ctrl-C is not interpreted by the shell. There is a lot of code > executing to translate every keypress between the time you press the > key, and the time it reaches your shell. > > Ctrl-C is interpreted by the terminal handler on the server. Again, > please now investigate how terminal emulation and terminal handling > works in Linux/UNIX. For Ctrl-C, the handler translates the keypress > into the POSIX signal SIGTERM, and sends the signal to the process > that is the session master for that virtual terminal (sleep) which > will then either catch the signal and do something implementation > specific as a result, or the default signal handler for SIGTERM will > be run, which exits the program. Please read more about signals. > > SSH2 supports sending signals to channels, but this is not > implemented neither in libssh2 nor in OpenSSH so in practice it > cannot be done at this time. I believe there are patches for both > packages, but so far they have not been merged. > > > //Peter > _______________________________________________ > libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel