]> arthur.barton.de Git - bup.git/commit - main.py
main.py: don't leak a file descriptor.
authorAvery Pennarun <apenwarr@gmail.com>
Sun, 21 Mar 2010 04:34:21 +0000 (00:34 -0400)
committerAvery Pennarun <apenwarr@gmail.com>
Sun, 21 Mar 2010 05:50:22 +0000 (01:50 -0400)
commit1eaed3810af2f3c30d69a33f6ebe6d108b4a4e04
treec153a65cfc7a4797504b4d64f5a52b94331c277b
parent45ff04984277522eae1a7bcb83db1d0881eae14f
main.py: don't leak a file descriptor.

subprocess.Popen() is a little weird about when it closes the file
descriptors you give it.  In this case, we have to dup() it because if
stderr=2 (the default) and stdout=2 (because fix_stderr), it'll close fd 2.
But if we dup it first, it *won't* close the dup, because stdout!=stderr.
So we have to dup it, but then we have to close it ourselves.

This was apparently harmless (it just resulted in an extra fd#3 getting
passed around to subprocesses as a clone of fd#2) but it was still wrong.
main.py