[python-win32] Setting service exit code on stop

Mark Hammond skippy.hammond at gmail.com
Sun Aug 9 21:08:29 EDT 2020


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
 > python-win32 at python.org
 > https://mail.python.org/mailman/listinfo/python-win32
 >


More information about the python-win32 mailing list