[Twisted-Python] how to stop a service

Ralph Meijer twisted at ralphm.ik.nu
Tue Jun 13 03:51:51 EDT 2006


On Sat, Jun 10, 2006 at 03:15:21PM -0400, Jean-Paul Calderone wrote:
> On Sat, 10 Jun 2006 17:01:55 -0200, Manlio Perillo 
> <manlio_perillo at libero.it> wrote:
> >Jean-Paul Calderone ha scritto:
> >>[...]
> >>>
> >>>Just another question: when running application with twistd, how can I
> >>>return error codes from my application to operating system?
> >>>
> >>>That is: where (and how) can I safely call os.exit?
> >>>
> >>
> >>There's no support for this yet.
> >>
> >
> >What about storing the return code in the application instance and call
> >os.exit(application.retcode) in an after shutdown system event?
> >
> 
> That's probably not a bad idea.  One slight change I would suggest is
> having the attribute be specified by the IProcess interface and stored
> on that facet of the application componentized.  See tickets #718 and
> #761 in the tracker.  If someone contributes patches implementing some
> functionality in this area I'll try to get it committed.

Wouldn't it be better to have the reactor.run() call to return the exit
code instead of something inside twisted calling os.exit() itself?

-- 
Groetjes,

ralphm




More information about the Twisted-Python mailing list