From the help I got on my other post, I came up with the following:
foreach exp_id [file channels "exp*"] {
puts "Spawn Id open: $exp_id"
}
However, this matches exp0, exp1 and exp2 (stdout, stdin and stderr). Is
there a way to not match these three?
There was still problem with the code above. file channels report back
spawn_ids for even the spawns that returned an eof and expect claim don't
exist any more (via exp_parse_i or something like that). Here is the latest
to close all the existing spawn_ids (since trace was on exp_out I have
included expect -i $exp_id *)
foreach exp_id [file channels "exp1*"] {
if {[info vars exp_id]} {
expect -i $exp_id *
send -i $exp_id "$CtrlC\rexit\r"
exp_sleep 0.5
expect -i $exp_id *
}
}
I am not sure if there is any adverse effect of sending Control-C\rexit\r
to stdout, stdin and stderr.