Expect on Windows, SSH/Telnet processes not closing properly

  • Follow


So, a few days ago I had posted this thread (http://groups.google.com/
group/comp.lang.tcl/browse_thread/thread/d4486bcff86ba5c5?hl=en) about
some issues with Expect on the Windows platform(s) not properly
closing the SSH/Telnet processes (i.e. exp_close & exp_wait don't seem
to work like they do on *nix machines, thus eating up more memory,
etc.)

I see that on some other mailing-lists, a few people have ran into
this as well. I don't quite have a solution, but in some sense, there
is a work-around.

Using plink.exe (PuTTY's command-line tool), you can send a single
command on the command line, or specify a file that has multiple
commands to run. I found out that sending one command via the command
line to get the same output as I would using expect, within my Tcl
script:

set data [exec {*}[auto_execok plink] -l <username> -pw <password>
somehost.somedomain "<command to send>"]

....properly closes the connection/process when looking at the task
manager. Then, I can do what I please with the output stored in
$data.

I know this may not going to be suitable for everyone, but I do a lot
of automating of network tasks, working with network devices, etc., so
this would be perfect for anyone who does the same (I would think).
Running multiple commands, you just have to have them in a text file
(one command on each line), and use the following syntax:

set data [exec {*}[auto_execok plink] -l <username> -pw <password> -m
<command file> somehost.somedomain]

Just thought that I'd post this in case anyone else is having these
issues, and needs a possible work-around.
0
Reply scottdware 9/3/2010 6:10:32 PM


0 Replies
712 Views

(page loaded in 0.037 seconds)

Similiar Articles:













7/23/2012 6:29:51 PM


Reply: