There is no,IMHO, foolproof way of killing a
process in this way. It may be zombied, in which
case you will fail and tcl doesn't have hooks deep
enough to tell you why natively.
I would have a look at TclX's signal handling
capabilities and design a procedure that calls
the 'to be killed' process in an as controlled env
as possible.
example
Code:
proc startfoo {foo } {
if {[set id [fork]] == 0} {
if {![catch {set fooid [exec $foo]} err]} {puts "Child at $fooid"}
wait $fooid
return 1;
}
puts "ERROR: $err"
return -1
}
More resilient here would be to use an ultimate timeout value while waiting with -nohang and a while loop checking
against the final exit the child.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.