Issue with Expect exp_wait hanging (Windows 7)

Posted by lucyk_1 on 2014-04-26 14:39
Forums: Expect discussion | OS: Windows 7

Hi, I am new to this board. We recently got new PCs with Windows 7 (64-bit). I installed 32-bit Tcl (version 8.4.20) with Expect 5.4.3. (It is my understanding that there is currently no 64-bit Expect for Windows)

The problem I am having is that my spawned sessions are not ending normally

I call a script that opens a serial connection to a device
exp_spawn tclsh $::TCL_LIB_DIR/serialConsole.tcl $::bm(comPort) $::bm(comSpeed)

at the end, when I try to close the spawned session:
catch exp_close
exp_wait

The exp_wait hangs forever.

Is there anything I can do to get around this issue? Any help/guidance would be appreciated. Thanks in advance...

petermark | Fri, 2015-01-30 09:05

Hi, I am assuming you do not need an answer anymore, but I will post what I found in case it can help others down the road. I was having the same problem, specifically when I spawned the connection in one proc and closed it in another. What I needed to do was replace

'exp_wait'
with
'exp_wait -i $spawn_id'

where spawn_id was returned from the first proc and passed to the second proc as a parameter.