In Twisted, what's the difference between processExited and processEnded?

As the name says, what is the difference between these two functions on ProcessProtocol classes? Documentation is a bit rare, when should it be used instead of another?

Preferably, I am looking for examples of use cases that demonstrate this.

+8
twisted
source share
1 answer

I think the documentation is somewhat sparse in this matter. If there is no such ticket, write a file to improve the API documents.

processExited is called when a process exits formal process control, i.e. called exit() or returned from main() .

However, this is not always what you want. Sometimes a process spawns a subprocess, breaks away from its stdin and stdout, delegates responsibility for creating the data that you (in this case, the spawning parent process), and then exit() , because it was setting up.

processEnded is called when a process completes and completes all I / O operations in managed file descriptors ( stdin , stdout and childFDs ), and they were closed. If you are creating something just to read your output, this is the notification that you most likely care about.

+8
source share

All Articles