Rev 384: Restore the default SIGPIPE handler before calling tar. in http://people.canonical.com/~robertc/baz2.0/plugins/builddeb/trunk
Robert Collins
robertc at robertcollins.net
Mon Nov 23 23:47:58 GMT 2009
At http://people.canonical.com/~robertc/baz2.0/plugins/builddeb/trunk
------------------------------------------------------------
revno: 384
revision-id: robertc at robertcollins.net-20091123234753-1e6yp0samsrn1z8g
parent: robertc at robertcollins.net-20091122034042-f9mhkmgvlfjjr3f1
committer: Robert Collins <robertc at robertcollins.net>
branch nick: trunk
timestamp: Tue 2009-11-24 10:47:53 +1100
message:
Restore the default SIGPIPE handler before calling tar.
=== modified file 'import_dsc.py'
--- a/import_dsc.py 2009-11-22 03:40:42 +0000
+++ b/import_dsc.py 2009-11-23 23:47:53 +0000
@@ -35,6 +35,7 @@
import md5
import os
import shutil
+import signal
import stat
from subprocess import Popen, PIPE
from StringIO import StringIO
@@ -1588,8 +1589,13 @@
def _extract_tarball_to_tempdir(self, tarball_filename):
tempdir = tempfile.mkdtemp()
try:
- assert os.system("tar xzf %s -C %s --strip-components 1"
- % (tarball_filename, tempdir)) == 0
+ old_sig = signal.getsignal(signal.SIGPIPE)
+ signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+ try:
+ assert os.system("tar xzf %s -C %s --strip-components 1"
+ % (tarball_filename, tempdir)) == 0
+ finally:
+ signal.signal(signal.SIGPIPE, old_sig)
return tempdir
except:
shutil.rmtree(tempdir)
More information about the bazaar-commits
mailing list