Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
For 2021 - online Python 3 training - see ((here)).

Our plans were to retire in summer 2020 and see the world, but Coronavirus has lead us into a lot of lockdown programming in Python 3 and PHP 7.
We can now offer tailored online training - small groups, real tutors - works really well for groups of 4 to 14 delegates. Anywhere in the world; course language English.

Please ask about private 'maintenance' training for Python 2, Tcl, Perl, PHP, Lua, etc.
Newbie question, Expect

Posted by eliasson (eliasson), 8 April 2008

I'm new to this forum so if I screw up, kindly let me know ...

I'm also fairly new to Expect/TCL.  My present task involves automating our software testing.  I've had some success along these lines for our Linux efforts, & am now working with Windows.

My setup is a Win2K host running Cygwin w/Expect & TCL.  The UUT (unit under test) also runs Win2k, no Cygwin.  The UUT is running an old Win remote console server.  The host is running the corresponding remote client (rclient.exe).  I'm trying to get this interaction into an Expect script.  If I run rclient from within my Cyg shell, the Cyg shell 'disappears' and a Cmd shell from the UUT magically shows up.  When I exit from the UUT shell, the Cyg shell magically re-appears.  When I try this in my script, I get a failure.  If I try this from the expect1.1> prompt, things appear to work, but I don't see any output from the UUT.

My script snippet looks as follows:
# Open remote session.  Send command to connect to UUT.
spawn /cygdrive/d/NTResKit/RCLIENT.EXE $::uutip
set remote_id $::spawn_id

expect -i $::remote_id -re $::prompt1
exp_send_user "\nconnected to $::uutip as user 'test'\n"

And the failure output is:
$ expect winRFMTestCyg.tcl
spawn /cygdrive/d/NTResKit/RCLIENT.EXE
parent: waiting for sync byte
parent: telling child to go ahead
parent: now unsynchronized from child
spawn: returns {2552}

expect: does "" (spawn_id 7) match regular expression "[cC]:.*>"? no
Cannot get screen info. The handle is invalid.

expect: does "Cannot get screen info. The handle is invalid.\r\r\n" (spawn_id 7)
match regular expression "[cC]:.*>"? no
expect: read eof
expect: set expect_out(spawn_id) "7"
expect: set expect_out(buffer) "Cannot get screen info. The handle is invalid.\r

connected to as user 'test'

It appears to me that my problem lies with a relationship betweein {2552} and (spawn_id 7), but I'm not sure.  I believe in the KISS principle & have steered clear of dealing with multiple spawned 'stuff' so far ...

If someone has a hint that helps, I'll be grateful, though not financially so I'm afraid.


This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2022: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: • WEB: • SKYPE: wellho