Rev 84: Popen.terminate is a py2.6 thing. in http://bazaar.launchpad.net/~meliae-dev/meliae/trunk
John Arbash Meinel
john at arbash-meinel.com
Fri Sep 11 18:49:37 BST 2009
At http://bazaar.launchpad.net/~meliae-dev/meliae/trunk
------------------------------------------------------------
revno: 84
revision-id: john at arbash-meinel.com-20090911174920-wgmza4klttnti2se
parent: john at arbash-meinel.com-20090911174107-zi78p7b0wwbs7yiq
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: trunk
timestamp: Fri 2009-09-11 12:49:20 -0500
message:
Popen.terminate is a py2.6 thing.
So do the best workaround I could come up with.
-------------- next part --------------
=== modified file 'meliae/files.py'
--- a/meliae/files.py 2009-09-11 17:41:07 +0000
+++ b/meliae/files.py 2009-09-11 17:49:20 +0000
@@ -61,7 +61,20 @@
# make reading from stdin, or writting errors cause immediate aborts
process.stdin.close()
process.stderr.close()
- return process.stdout, process.terminate
+ terminate = getattr(process, 'terminate', None)
+ # terminate is a py2.6 thing
+ if terminate is not None:
+ return process.stdout, terminate
+ else:
+ # We would like to use process.wait() but that can cause a deadlock
+ # if the child is still writing.
+ # The other alternative is process.communicate, but we closed
+ # stderr, and communicate wants to read from it. (We get:
+ # ValueError: I/O operation on closed file
+ # if we try it here. Also, for large files, this may be many GB
+ # worth of data.
+ # So for now, live with the deadlock...
+ return process.stdout, process.wait
def _stream_file(filename, child):
More information about the bazaar-commits
mailing list