Re: Setting service exit code on stop

Mark Hammond <[email protected]>
Newsgroups gmane.comp.python.windows
Message-ID <[email protected]>
Do you mean the process exit code? There's no direct way to influence 
that, although you can probably just arrange to kill your own process - 
you'll need to manually ensure you've set the service status before you 
do this.

See also https://github.com/mhammond/pywin32/issues/1563 where there's a 
request for something slightly different (specifically, for pywin32 to 
*not* update the status as STOPPED on an exception so Windows sees it as 
an abnormal exit) - but the work-around there is similar - just kill 
your own process.

A feature request would be fine, but a PR would be even better ;) Te 
feature request would need to be a very concrete proposal.

Cheers,

Mark

On 9/08/2020 11:19 am, Robert Kearns wrote:
 > Hello all,
 >
 > I am having a look through the C++ source code (in
 > particular win32/src/PythonService.cpp), trying to deduce a way to have
 > the Python service set the exit code on stop.
 >
 > It appears that on a successful stop, both exit codes (svc and win32)
 > are set to 0, overriding any previously set value.
 >
 > Does anyone know of any way around this? If not, would this be a welcome
 > feature request?
 >
 > Best regards,
 > Rob
 >
 > _______________________________________________
 > python-win32 mailing list
 > [email protected]
 > https://mail.python.org/mailman/listinfo/python-win32
 >
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.