| |||||||||||
telnet, expect and the web Posted by pentafive (pentafive), 11 July 2007 I have a expect script that telnets to a host and runs a commands and exits. The expect script is called from a KSH cgi script and then displayed to the user via a webpage.The script works great when called from a shell script but when called from the webserver the spawned telnet session has a problem with the screen size and thus my output is littered with "Press any key to continue (Q to quit)". I tried to use log_user 0/1 in the expect script to control what out is sent to the user and that works when it is called from CLI but over the web I get NO output at all so i am not using them at the moment. Any ideas? -Jonathan Posted by admin (Graham Ellis), 11 July 2007 I would be tempted to play with the TERM and TERMCAP environment variables to make the web one look more like the CLI one.Posted by pentafive (pentafive), 11 July 2007 Thanks for the quick reply. I did play some with TERM but after your post I did some more.I tried to use the following: Code:
I checked to make sure telnet recieved the new env setting with the following expect script. Code:
And it listed the TERM and TERMCAP env. BUT...it still did not fix the web problem. Gonna do some more playing around but wanted to post that.. Ohh I also tried vt100 and a few other termcaps. -Jonathan Posted by admin (Graham Ellis), 11 July 2007 Hmmm .... it is possible for applications to check whether or not they're running from an interactive shell and perhaps yours is doing so; as an intermediate research step, see what happens when you run you command line interface version with input and output redirects from and to files.Posted by pentafive (pentafive), 11 July 2007 ok I will do that next. I can now reproduce this in the shell by calling the telnet app with "-nottycopy" Code:
-Jonathan This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |