MHo, 2009, June 20.:
Example-1:
tk_messageBox -message "before" exec -- [auto_execok cmd] << { notepad sleep 5 } & tk_messageBox -message "after"
With example-1, everything works as expected:
The main window of the tk prog stays responsive all the time, because of exec ... &.
Example-2:
tk_messageBox -message "before" exec -- [auto_execok cmd] << { notepad sleep 5 } tk_messageBox -message "after"
With example-2, things are slightly different:
At this point, the stop message still doesn't pop up, which is at first thought correct, because exec works in synchronous mode (without &). But: notepad has started in the background (so this step has finished), sleep has started and finished after 5 seconds, so why does exec not comes to an end??? The main program (at least its main window) seems to be in some indifferent state somewhere within the exec step, receiving input (windows goes to foreground) but does not redraw itself anymore, soon becoming an empty white box if obscured by other windows etc...
Only after closing notepad, the end message appears, and everything continues the normal way.
Addition, 2010-10-28 MHo:
Starting console mode applications from tclsh with exec doesn't always work. If I start e.g. the Hessling Editor (THE), that editor complains about wrong console dimensions. If I start a powerbasic console mode program which displays the console dimensions, it shows rows x cols = 1 x 65473. Resetting those dimension fails. The solution to this particular problem was to start a win32-mode-wrapper-program which in turn starts THE. This works, because when win32 starting console mode apps via windows mechanisms, a new console is created (I think). I know the problems are discussed elsewhere here on the wiki, and I left some comments on some pages before... I think, exec needs some more switches to control such things at least on ms windows.