Ignore:
Timestamp:
Oct 18, 2012, 3:01:53 PM (12 years ago)
Author:
gah
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lang/tcl/scripts/exec.tcl

    r3182 r3185  
    4646    append execout(output) $execout(extra)
    4747
    48     if {$status != 0} {
    49         if {[regexp {^KILLED} $execctl] && [llength $execctl] == 4} {
    50             set reason [lindex $execctl end]
    51             set result "job killed: $reason"
    52         }
     48    if { $status != 0 } {
     49        # We're here because the exec-ed program failed
     50        if { $execctl != "" } {
     51            foreach { token pid code mesg } $execctl break
     52            if { $token == "EXITED" } {
     53                # This means that the program exited normally but
     54                # returned a non-zero exitcode.  Consider this an
     55                # invalid result from the program.  Append the stderr
     56                # from the program to the message.
     57                set result \
     58                    "Program finished: exit code is $code\n\n"
     59                append result $execout(error)
     60            } elseif { $token == "abort" }  {
     61                # The user pressed the abort button.
     62                set result "Program terminated by user.\n\n"
     63                append result $execout(output)
     64            } else {
     65                # Abnormal termination
     66                set result "Abnormal program termination: $mesg\n\n"
     67                append result $execout(output)
     68            }
     69        }
    5370        error $result
    5471    }
     
    7289    #
    7390    if {$channel == "stderr"} {
     91        append execout(error) $message
    7492        set newmesg ""
    7593        foreach line [split $message \n] {
     
    7896        set message $newmesg
    7997    }
    80 
    8198    #
    8299    # If this message is coming in on the same channel as the
Note: See TracChangeset for help on using the changeset viewer.