rubberscissors
Technical User
I'm working on some test tools using expect, and I want to create a series of functions that each issue a series of commands to check and gather output. I'd like to be able to use these as part of a library which can be called from other scripts, but I'm running into the following problem:
Whenever the main function spawns a telnet session to the device being tested, if I send commands down from the main function they work, but if I try and send commands from another function called from within the main function, they don't work.
For example, I want to check port information using the command 'showPort'. If I spawn a telnet session from the main function, then expect the prompt, then send the command showPort, it works. If, on the other hand, I spawn a telnet session from the main function, then call another function (proc showport) which then expects the prompt and sends the command showPort, the command is never sent.
Has anyone else encountered this and know why it happens? Does the new function need to be told about the telnet session spawned from the main function? If so, does anyone know how to accomplish this? Any help would be appreciated.
Whenever the main function spawns a telnet session to the device being tested, if I send commands down from the main function they work, but if I try and send commands from another function called from within the main function, they don't work.
For example, I want to check port information using the command 'showPort'. If I spawn a telnet session from the main function, then expect the prompt, then send the command showPort, it works. If, on the other hand, I spawn a telnet session from the main function, then call another function (proc showport) which then expects the prompt and sends the command showPort, the command is never sent.
Has anyone else encountered this and know why it happens? Does the new function need to be told about the telnet session spawned from the main function? If so, does anyone know how to accomplish this? Any help would be appreciated.