Tcl Source Code

Ticket Change Details
Login
Overview

Artifact ID: fa019d6ce40db583426bc7c42cadaa0c264928bb
Ticket: 8f559999fa000614504de7a7eefbc99dc7beea2b
background error swallowed with command delete trace on a coroutine
User & Date: sebres 2017-06-23 08:12:13
Changes

  1. closedate changed to: "2457927.84182281"
  2. closer changed to: "sebres"
  3. icomment:
    I realized that your tracing initialization is wrong here - command executed from trace expects specified arguments.
    
    If you rewrite your code like:
    <code><verbatim>
    proc bgerror {error options} {
        puts stderr [dict get $options -errorinfo]
        puts stderr *************exit-1
        exit 1
    }
    
    proc p1 {} {
        yield [info coroutine]
        puts *************produce-error
        error {never gonna give you up}
    }
    
    proc trace-c1 {args} {
        puts *************in-trace--$args
    }
    
    coroutine main ::apply [list {} {
        yield [info coroutine]
        coroutine c1 p1
        # wrong trace:
        # trace add command c1 delete [info coroutine]
        trace add command c1 delete [list trace-c1 [info coroutine]]
        yieldto c1
        puts stderr *************exit-0
        exit 0
    } [namespace current]]
    
    after idle main
    interp bgerror {} [namespace which bgerror]
    vwait forever
    </verbatim></code>
    
    You'll then see:
    <code><verbatim>
    *************produce-error
    *************in-trace--::main ::c1 {} delete
    never gonna give you up
        while executing
    "error {never gonna give you up}"
        (procedure "p1" line 4)
        invoked from within
    "p1"
        invoked from within
    "c1"
        invoked from within
    "main"
        ("after" script)
    *************exit-1
    </verbatim></code>
    
    Thus I close this as invalid. Please reopen if I'm wrong.
    
  4. login: "sebres"
  5. mimetype: "text/x-fossil-wiki"
  6. resolution changed to: "Invalid"
  7. status changed to: "Closed"