[Twisted-Python] how to ensure writes to stdout via stdio.StandardIO are completed before we shutdown the reactor?

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Tue Jan 31 23:01:44 MST 2012


On 03:59 am, rutt.4 at osu.edu wrote:
>Hi twisted community,
>
>What’s the best way to ensure writes to stdout via stdio.StandardIO
>are completed before we shutdown the reactor?   The use case is to
>emit an error message before we shutdown the reactor and stop our
>program.  Dummy code snippet:

If you call the transport's loseConnection method, then the protocol's 
connectionLost method will be called after the output buffer is 
completely written.

Jean-Paul



More information about the Twisted-Python mailing list