Languages and Scripting
Showing results for 
Search instead for 
Did you mean: 

Expect "spawn" command hangs

Narendra Uttekar
Regular Advisor

Expect "spawn" command hangs


When running the Expect script, it hangs at the spawn command until I issue a control-C.


I have installed expect 5.45, tcltk 8.5.15 on HP-UX 11.31.


Here is the basic script :
#!/usr/local/bin/expect -d
spawn ""
expect "password:"
send "password\n"
expect "sftp>"
send "mget *.* \r"
expect "sftp>"
send "quit \r

And here is the debug:
expect version 5.45
argv[0] = /usr/local/bin/expect argv[1] = -d argv[2] = ./sftptest
set argc 0
set argv0 "./sftptest"
set argv ""
executing commands from command file ./sftptest
spawn sftp
parent: waiting for sync byte

                   <----- Hangs here forever until I issue Control-C

parent: telling child to go ahead
parent: now unsynchronized from child
spawn: returns {9247}
sighandler: handling signal(2)
async event handler: Tcl_Eval(exit 130)


I tried to find the solution on forum and found that if we install the earlier version of tcltk 8.5.8 problem will fix. But i was not able to find the depot tcltk8.5.8. And tried downloading the 8.5.8 source code. But I am able to build and install TCL8.5.8 but getting error while building TK 8.5.8

100 errors detected in the compilation of "/tmp/tcltk-8.5.8-src/unix/../generic/tk3d.c".

Compilation terminated.

*** Error exit code 4





Dennis Handly
Acclaimed Contributor

Re: Expect "spawn" command hangs

>100 errors detected in the compilation of "tk3d.c".


This is useless.  What are the first few errors.