Re: TclX on Windows - anybody successfully trap SIGTERM / SIGKILL
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: TclX on Windows - anybody successfully trap SIGTERM / SIGKILL

From: Roy Terry <royterry@earthlink.net>
Date: Tue Dec 27 2005 - 20:19:48 CET

"David Gravereaux" <davygrvy@pobox.com> wrote in message
news:2gt2r1d2ubadvvb58vopb4aob4veet7uvr@4ax.com...
> On Tue, 27 Dec 2005 16:27:41 GMT, "Roy Terry" <royterry@earthlink.net>
> wrote:
>
> >Cool! I will roll this into my next build.
> >And I'm wondering if the catch still work if the process is run
> >in the background. I'm working with Tcl-based
> >servers that are started by a windows service
> >with exec .... &
> >
> >Happy New Year,
> >Roy
>
> Yes, they will. But there's an issue when run as a service. You're
> going to have to "catch" the logoff event and ignore it. Something
> like this:
>
> rename exit _exit
> proc exit {{code 0}} {
> switch {$code} {
> case 0xC0000013D {
> # temporary exit code for CTRL_LOGOFF_EVENT
> puts "doh! we ain't shutting down for a logoff event!"
> return -code continue
> }
> default {
> _exit $code
> }
> }
> }
>
> You might consider a real service shell instead, like Matt Newman's
> (?) tclservice. tclsh is a shell for being a console application ;)
> With a service shell, you have builtin commands for start, stop,
> install, and uninstall and understands how to behave properly under
> the service manager.
To clarify: I do have a proper win. service executable built with
ActiveState
TclDevkit. That service, in turn, starts various tclsh.exe to do the "real
work"
with stdout and stderr redirected to regular files.
Are you saying these spawned tlcsh processes are somehow
not kosher uses of the tcl shell?

>
> I'll test the script out. The patch might require a change.
Received on Tue Jan 3 03:09:20 2006