Browse Source
Root cause: Tk registers a main loop (Tcl_SetMainLoop); tclsh''s Tcl_Main services it after the script, so `tclsh gui.tcl` behaves like wish. The script subcommand sourced-then-exited, so a Tk script''s after-callbacks never ran (scriptlib/tktimer.tcl flashed and died; shell was the workaround). Confirmed: native tclsh tktimer 1 blocks ~1.35s; script did 0.38s. Fix: after the script body (success paths only), if a Tk main loop is registered (info exists ::tk_version && winfo exists .), tkwait window . services the event loop until the main window closes, then exit - the script-level equivalent of Tcl_Main. A script that exits from a callback (tktimer countdown) terminates directly. Console scripts have no main loop and exit at once; a script error exits at once (no hanging window). Verified both generations: tktimer via script now blocks the countdown (punk902z 1.49s, punksys 1.57s - Tk present in both) exit 0; tkhello_exit immediate; tk-script-that-errors exit 1 in 0.37s (no hang); tkhello (no self-close) blocks like wish; console script unaffected. Enables G-020 GUI automation via `script` instead of `shell` (noted in G-020 detail). Project version 0.4.1. Assisted-by: harness=claude; primary-model=claude-fable-5; api-location=anthropic.commaster
6 changed files with 61 additions and 14 deletions
@ -1,3 +1,3 @@
|
||||
[project] |
||||
name = "punkshell" |
||||
version = "0.4.0" |
||||
version = "0.4.1" |
||||
|
||||
Loading…
Reference in new issue