better handle error color codes for processes that get killed

This commit is contained in:
stefan schippers 2023-11-08 02:27:56 +01:00
parent eb7ad4cd8e
commit c485e7ef7a
1 changed files with 6 additions and 2 deletions

View File

@ -228,7 +228,7 @@ proc set_ne { var val } {
#
# execute service function
proc execute_fileevent {id} {
global execute OS has_x
global execute OS has_x errorCode
append execute(data,$id) [read $execute(pipe,$id) 1024]
if { $OS != {Windows} } {
@ -261,10 +261,14 @@ proc execute_fileevent {id} {
if {$finished} {fconfigure $execute(pipe,$id) -blocking 1}
set exit_status 0
set catch_return [eval catch [list {close $execute(pipe,$id)} err] ]
# puts "catch_return=$catch_return"
if {$catch_return} {
global errorCode
# puts "errorCode=$errorCode"
if {"CHILDSTATUS" == [lindex $errorCode 0]} {
set exit_status [lindex $errorCode 2]
# puts "exit_status=$exit_status"
} else {
set exit_status $catch_return
}
if {$exit_status != 0} {
if {$report} {viewdata "Failed: $execute(cmd,$id)\nstderr:\n$err\ndata:\n$execute(data,$id)"}