I'm trying to write a proc that waits in the background on a file and launches a command and keeps on getting stuck while waiting
My code:
proc stuck_on_kuku {} {
while {![file exists kuku]} {
after 3000
}
echo done sleeping ; # here my command should appear
}
Now, when I call this proc in background mode, it jams my shell until done. The shell is recording key strokes, but will only consider them after the kuku file is created> after idle stuck_on_kuku
Also tried to create an uplevel version of the proc, but still gets the same behavior.
Isn't there a way to wait for a file creation without jamming the tcl shell?
My goal is to have 2-3 of these background runs in parallel, each waiting on something else and launching something else.
Oh, and - worth a mention - I have no access to the Threads package on this env, so must make do with vanilla tcl 8.6