Prev: Help fix my code: Problem in making folder contents backup then delete it
Next: clock today not consistent
From: horia314 on 28 Jul 2010 04:34 Hello, I've run into a strange issue while using tcl with the tclreadline and expect libraries. I don't know if it's a bug or if I'm doing something wrong, but any help would be appreciated. This is the smallest test example I can think of for which the problem is reproducible: package require tclreadline package require Expect after 5000 {spawn ls} # any delay and any shell command words. tclreadline::readline initialize history while 1 { tclreadline::readline read {> } } The readline built "shell" works fine until the after event triggers, at which point the program stops responding and I have to kill it with Ctrl+C (I think tclreadline dies somehow). Using other commands (even exec and open) in the after script or using other commands that wait (vwait) in the while script works. I don't know why this happenes, but I suspect it has something to do with the way expect forks a process. From what I've dug "tclreadline::readline read" enters into a loop, waiting for libreadline to signal that a valid line has been read, and does Tcl_DoOneEvent in the meanwhile. Maybe after combined with spawn messes with it's processing. I have a workaround for this issue (I launch the tclreadline part of the application in a separate script, with exec) but any help or insights on this issue would be helpful. Thank You, Horia PS. I use the latest tcl, tclreadline and expect versions (8.5.8,2.1.0 and 5.44.1.15 respectivly). |