Re: Killing a running process
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: Killing a running process

From: al-s <stosh259@hotmail.com>
Date: Fri Mar 03 2006 - 20:45:16 CET

OK. This is what I tried and I get an error: can't read "pids": no
such variable. The log reads the above plus: wile executing
"kill-proc $pids"
   (command bound to event)

Code is as follows:

proc RunCmd {command log} {
   if [catch {open "|$command |& cat"} fd] {
      $log insert end $fd\n
   } else {
      set pids [pid $fd]
      bind $log <Control-Key-c> {kill-proc $pids}
      fileevent $fd readable [list Logger $fd $log]
      vwait done
     }
}

proc kill-proc {pids} {
   catch {exec kill $pids}
}

Can someone see if I'm doing something wrong - it looks right. But If
that were true I would have asked for help.

Thanks again
Received on Sun Apr 30 02:23:00 2006