| ||||
Forcing a command to be completed Posted by gurudatt (gurudatt), 19 March 2008 Hello,I open a telnet session and send commands to it. one of the commands that i send takes a lot of time to execute, and by this time sometimes the next command also gets executed. Also the framework that i have developed is such that from my main file i say i have to open a telnet session by creating a object of the class that i have created in another file. Now to this object i send commands and the function that accepts this has been implemented such that it expects and sends commands. main.tcl-- main file x a telnet x sc command1 x sc command2 impl.tcl--class that implements class x { spawn telnet sc {command } { expect "->" { send -i $id command } } Is there anyway that i can force the next command not to be executed/sent until the previous one? i.e can i force commad2 to be sent only after command one has finished sending it. Posted by admin (Graham Ellis), 19 March 2008 set the timeout variable before you execute the first command to long enough to allow it o complete before your send / expect sequence. That way, expect won't give up and go on to the next command too quickly.set timeout 50 to allow 50 seconds, for example Posted by gurudatt (gurudatt), 20 March 2008 Hi,It didnt work. Posted by admin (Graham Ellis), 21 March 2008 Oops - I didn't notice that you weren't waiting - you were sending the first command then carrying right on without even trying to wait for the command to finish so, I agree, timeout won't work.Try waiting for the telnet session to return with the next prompt: Code:
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 |