I see this a lot in example code, where people wait on a process to exit and then collect it's return code using "catch wait result" and then usually something like "exit [lindex $result 3]" to return the process' exit code. This doesn't seem right at all.
Firstoff, it seems like wait already does a pretty good job of handling weird process termination. From [1]:
wait normally returns a list of four integers. The first integer is the pid of the process that was waited upon. The second integer is the corresponding spawn id. The third integer is -1 if an operating system error occurred, or 0 otherwise. If the third integer was 0, the fourth integer is the status returned by the spawned





