>
> Closing stdin is probably the best option here, but the original
> problem was caused by a mixing of levels.
>
> On one level, you've got open(), which wants to sort of pretend that
> an open file is an object, and that the operating system resource
> involved is an implementation detail that can be cleaned up by the
> garbage collector.
>
> On the other level, you've got spawnProcess, which is operating
> entirely in terms of file descriptors as process-global state.
>
> Any time you want to open a file descriptor for spawnProcess to
> consume, I suggest that you open it with os.open
> <https://docs.python.org/2/library/os.html#os.open>, which just hands
> you an integer and makes it your own problem to close it explicitly
> with os.close <https://docs.python.org/2/library/os.html#os.close>;
> this is operating at the same abstraction level and therefore less
> error-prone.

That's useful to know, thanks. I'll remember it for next time!

Peter.
_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to