title: how to use Tcl's (interp) bgerror
body: <p>I'm trying to <a href="http://www2.tcl.tk/8755" rel="nofollow noreferrer">run tclhttpd in a slave interpreter</a> but slightly modified so as to run within a tclkit.  The code below "runs" (I can hit <a href="http://localhost:8015" rel="nofollow noreferrer">http://localhost:8015</a>) but never reaches the puts line at the bottom because "the server does not return, it enters [vwait forever]".  But when I try "the after 0 trick", e.g. prepending "after 0 " to the line "$httpd eval $cmd", the server does not run at all, so I presume "errors have to be handled by bgerror"</p>
  
  <p>However I cannot find good examples of how to use bgerror, plus my research shows that now the convention is to use "interp bgerror".  Please see the first couple of examples returned by <a href="http://www2.tcl.tk/_/gsearch?S=bgerror" rel="nofollow noreferrer">http://www2.tcl.tk/_/gsearch?S=bgerror</a>; the first link contains the verbiage "fill in useful tricks and examples for using bgerror" but then there are no samples I can discern how to apply, and the second link concludes "I am interested in examples how this is supposed to be used."</p>
  
  <pre><code>package require starkit
  starkit::startup
  
  set httpd_args [list]
  set httpd [interp create]
  $httpd eval "set argc [llength $httpd_args]"
  set cmdargv "set argv [list $httpd_args ]"
  $httpd eval "set topdir $starkit::topdir"
  $httpd eval $cmdargv
  
  set cmd [list source [file join $starkit::topdir bin/httpd.tcl]]
  $httpd eval $cmd
  
  puts "if seeing this controlled has returned"
  </code></pre>