Expect: spawned process in sleep state (log_file problem?)
From: Bob - Andover, MA (tsreyb_at_yahoo.com)
Date: 09/22/04
- Next message: Cameron Laird: "Re: Tcl/Expect for Windows"
- Previous message: Sid Pollock: "Re: Tcl/Expect for Windows"
- Next in thread: Don Libes: "Re: Expect: spawned process in sleep state (log_file problem?)"
- Reply: Don Libes: "Re: Expect: spawned process in sleep state (log_file problem?)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 22 Sep 2004 11:56:11 -0700
I have a working Expect script which spawns another tcl script
(capturing its output to a file) and then continues on to do other
useful things. The general idea is:
#!/usr/local/bin/expect --
#-- First, spawn the xyz script
log_file xyz.txt
spawn xyz.tcl
expect {
eof {
}
}
catch {close -i $spawn_id}
catch {wait -i $spawn_id}
log_file
#-- Now do more stuff ..
set abc [expr 1 + 2]
puts "abc is $abc"
Today I decided to see if I could do the "more stuff" section while
the xyz script ran in background.
I think I'm very close to having it operational, but the spawned xyz
script gets into a sleep state for some reason. I suspect it is
because it no longer has its log file attached (because I explicitly
detached it). I could leave it attached, but the problem is I do NOT
want the output of xyz and "more stuff" to be intermingled - I really
want xyz to have its own log file.
Here's how I currently have it implemented (in the broken state):
#!/usr/local/bin/expect --
#-- First, spawn the xyz script
log_file xyz.txt
spawn xyz.tcl
log_file
#-- Now do more stuff ..
set abc [expr 1 + 2]
puts "abc is $abc"
#-- Wait for xyz..
expect {
eof {
}
}
catch {close -i $spawn_id}
catch {wait -i $spawn_id}
- Next message: Cameron Laird: "Re: Tcl/Expect for Windows"
- Previous message: Sid Pollock: "Re: Tcl/Expect for Windows"
- Next in thread: Don Libes: "Re: Expect: spawned process in sleep state (log_file problem?)"
- Reply: Don Libes: "Re: Expect: spawned process in sleep state (log_file problem?)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|