Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to kill the process..

Status
Not open for further replies.

bebig

Technical User
Oct 21, 2004
111
US
hi ..
i want to kill the process..

this is what I am thinking about the systax.

I want to kill pid and process (err).
eval exec kill [$pid $err]


Thank you in advance
 
i want to kill the process if there is no response.

I want to kill pid or process(err).

this is what I am thinking about the systax.

--> eval exec kill -9 $err
--> eval exec kill -9 $pid

how to kill the processes???

Thank you in advance
 
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.

HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top