Posted to tcl by aspect at Fri Mar 01 22:49:16 GMT 2024view raw
- #!/usr/bin/env tclsh
- #
- #
- set interp [interp create]
- $interp eval {
- proc Try {script} {
- list [catch {uplevel #0 $script} e o] $e $o
- }
- }
- proc Call {interp script} {
- lassign [$interp eval [list Try $script]] rc res opts
- return -code $rc -options $opts $res
- }
- proc putl args {
- puts $args
- }
- interp bgerror {} {putl bgerror}
- after 0 {Call $interp {expr 1/0}}
- after 100 {incr forever}
- vwait forever
- puts done