[Twisted-Python] how to stop a service

Jean-Paul Calderone exarkun at divmod.com
Sat Jun 10 14:52:00 MDT 2006


On Sat, 10 Jun 2006 18:17:35 -0200, Manlio Perillo <manlio_perillo at libero.it> wrote:
>Jean-Paul Calderone ha scritto:
>> 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.
>
>Yes, this is much better.
>
>> 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.
>>
>
>By the way, there is no support for installing user defined handlers for
>signals?
>
>In this way I can implement this idea in my application.
>

You can just use the signal module to install whatever handlers you
like.

Jean-Paul




More information about the Twisted-Python mailing list