Answer swiped from http://www.linuxquestions.org/questions/programming-9/just-wonder-how-to-get-exit-status-of-pragram-in-tcl-code-645406/
--- Quote Start ---
quote from activetcl 8.5.2.0 help pages
Code:
To execute a program that can return a non-zero result, you should wrap the call to exec in catch and check the contents of the -errorcode return option if you have an error:
set status 0
if {} {
set details
if { eq "CHILDSTATUS"} {
set status
} else {
# Some kind of unexpected failure
}
}
quote from man n exec
Code:
To execute a program that can return a non-zero result, you should wrap the call to exec in catch and check |
what the contents of the global errorCode variable is if you have an error:
set status 0
if {} {
if { eq "CHILDSTATUS"} {
set status
} else {
# Some kind of unexpected failure
}
}
--- Quote End ---