Skip to content

Commit

Permalink
Handling the error when the tcl dict gets a non-exist key
Browse files Browse the repository at this point in the history
  • Loading branch information
yangbodong22011 committed Dec 21, 2020
1 parent e171b27 commit 56e04ff
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/support/server.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ proc kill_server config {
catch {exec leaks $pid} output option
# In a few tests we kill the server process, so leaks will not find it.
# It'll exits with exit code >1 on error, so we ignore these.
set details [dict get $option -errorcode]
if {[lindex $details 0] eq "CHILDSTATUS"} {
set status [lindex $details 2]
if {$status > 1} {
set output "0 leaks"
}
if {[dict exists $option -errorcode]} {
set details [dict get $option -errorcode]
if {[lindex $details 0] eq "CHILDSTATUS"} {
set status [lindex $details 2]
if {$status > 1} {
set output "0 leaks"
}
}
}
set output
} {*0 leaks*}
Expand Down

0 comments on commit 56e04ff

Please sign in to comment.