[python-win32] Re: How to determine whether program running
asservice?
Mark Hammond
mhammond at skippinet.com.au
Fri Sep 10 07:47:43 CEST 2004
> >> I don't see one :( I would be happy to add one - eg,
> >> sys.serviceexecutable being set to the host executable when
> >> launched as a service.
>
> Is it possible to determine that a process is launched as service? I
> don't think there is one, at least I didn't find one.
No direct way I found - but service_main() could set a flag - this code
knows for certain it is running as a service (or for debugging).
Thinking about it a bit more - since this code exists in servicemanager.pyd,
it makes the most sense for servicemanager.pyd itself to have these
attributes.
servicemanager.is_service = boolean
servicemanager.is_debugging = boolean
That shouldn't be too hard to setup. 'serviceexecutable' is a bit silly,
but it kinda made sense given the various other sys.dll/executable variables
used. But keeping it out of sys makes far more sense.
Thoughts?
Mark
More information about the Python-win32
mailing list