Expect discussion

Mostly for Windows port of Expect

Expect sripts can't be run by activeTcl

I had expect script that is run perfectly on RedHat but when i tried to run it on windows 7 using activeTcl, it didn't run and i got error invalid command name "spawn"

so does activeTcl have expect package?

TCl Expect with Windows 8

We have written many TCL scripts(TCL 8.5) with Expect 5.3 to interact with the router, mainly Cisco Routers. We execute these scripts from a stand alone application which is a desktop based one. We have not faced any problem in Mac or windows Xp or Windows 7.

The problem is with Windows 8.
tclsh crashes when we try to 'spawn' in windows 8.
We tried adding sleep, inserting #!/usr/bin/expect -f at the beginning of the scripts, Remove all Comments, update Expect and TCL. But no use :(

What is the possible solution for this??

Thanks in advance.

Tcl Expect with Putty telnet


Trying to achieve a goal of running putty's plink -telnet via Tcl Expect.

When i do a regular:
plink -telnet %ip%

i get an output of the process and am able to properly conduct what i have planned.

But when i try the same from Tcl Expect:
% package require Expect
% exp_internal 1
% spawn plink -telnet %ip% -s
% expect -nocase login

expect: does "" (spawn_id exp4) match glob pattern "login"? no
expect: timed out

there is simply no response from the piped process.

Tcl: 8.6(x86)
Expect: 5.43.2
Putty: latest x86
Win10 x64

Where is Expectk ?

I used Expect for awhile on one project many years ago, and have pretty much forgotten everything I once knew, so please view this "noobie" question in that light. The original book by Don Libes, chapter 19 mentions a companion program called Expectk (Expect + Tk). I cannot seem to find it in any open source repositories or sites. Yet the README file of the most recent .tar.gz file that I downloaded from the Expect home page still mentions it. Does anybody know where I can get this companion program, or if it no longer in use, why that is so?
Thank you.

exp_send not handling binary data correctly

I'm trying to use Expect to read and write bytes across a serial port to a hardware device. I've got a logic analyzer watching the serial TX and RX lines, so I can see what is sent and received. Everything works ok as long as bit 7 of the data is not set. If bit 7 is set, it looks like 0xC2 is prepended to the real data (i.e. two bytes are sent, 0xC2 followed by the data). A snippet of code that I tested this with:

if {[catch {open $options(-port) r+} handle]} {
return -code error "port $options(-port) failed to open: $handle"

Ctrl-C crashs the tcl at vwait call

Hi ActiveState,

I run into this crash issue, which you could reproduce with run following simple code:
package require Expect

set tovar 1
set strCmd "cmd.exe"
set pid [exp_spawn $strCmd]
puts "The pid is: $pid"
puts "now vwait"
vwait tovar
puts "end"
Script will stop at vwait call, then hit "Ctrl-C" to stop. Windows reports crash after this information:

FlushChannel: damaged channel list

Any solutions yet for Windows Expect on Windows Server 2012

I'm also can't get Windows Expect to work on Windows Server 2012. My TCL/Expect scripts work fine on early versions of windows (e.g. Windows Server 2008). I've read the forums and see that others posted about this (https://community.activestate.com/node/10826). My question is, has there been any progress or work arounds for this. Any suggestions. Or is Windows Expect pretty much dying out for current/future versions of MS Windows.

Can't find package Expect, ActiveTCL 8.6.4

I installed ActiveTCL 8.6.4 x32 on Windows 7. Installed Expect by running:
teacup install Expect

But when I run:
package require Expect

I get:
can't find package Expect
while executing
"package require Expect"
(file "expect.tcl" line 4)

What am I doing wrong?

TCL segfault crash when package require Expect

Script tested -

Inside - /opt/bin/expect

set pool [tpool::create -minworkers [array size inputListToRun] -initcmd {
spawn telnet

Output - invalid command name "spawn"

Modified script -

Inside - /opt/bin/expect

set pool [tpool::create -minworkers [array size inputListToRun] -initcmd {
package require Expect
spawn telnet

Output - Segmentation fault(core dumped)

Please help me understand what is going wrong here. How would I make spawn work inside a Thread.

Tclsh version - 8.6
Thread version - 2.7.2

Expect matching angled bracket prompt


I need some help in understanding something about an expect script I am working on. I actually found a way to make what I want work, but I am not sure exactly what it works, and was hoping somebody could enlighten me.

Basically, I have an ActiveTCL/Expect script that does the following:

- spawns plink to SSH into a box
- once logged into the box, I run a program that returns a different prompt. The prompt that gets returned is simply the right angle bracket. It looks like this: >