[Pkg-bazaar-commits] ./bzr-builddeb/trunk r354: Also avoid problems with SIGPIPE when running the build command.

James Westby james.westby at canonical.com
Wed Jul 15 20:48:37 UTC 2009


------------------------------------------------------------
revno: 354
committer: James Westby <james.westby at canonical.com>
branch nick: trunk
timestamp: Wed 2009-07-15 21:48:37 +0100
message:
  Also avoid problems with SIGPIPE when running the build command.
modified:
  builder.py
  debian/changelog
-------------- next part --------------
=== modified file 'builder.py'
--- a/builder.py	2009-03-04 01:36:17 +0000
+++ b/builder.py	2009-07-15 20:48:37 +0000
@@ -19,6 +19,7 @@
 #
 
 import shutil
+import signal
 import subprocess
 import os
 
@@ -33,6 +34,13 @@
         )
 
 
+def subprocess_setup():
+    # Python installs a SIGPIPE handler by default. This is usually not what
+    # non-Python subprocesses expect.
+    # Many, many thanks to Colin Watson
+    signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+
+
 class DebBuild(object):
     """The object that does the building work."""
 
@@ -77,7 +85,8 @@
         """This builds the package using the supplied command."""
         info("Building the package in %s, using %s", self.target_dir,
                 self.builder)
-        proc = subprocess.Popen(self.builder, shell=True, cwd=self.target_dir)
+        proc = subprocess.Popen(self.builder, shell=True, cwd=self.target_dir,
+                preexec_fn=subprocess_setup)
         proc.wait()
         if proc.returncode != 0:
             raise BuildFailedError

=== modified file 'debian/changelog'
--- a/debian/changelog	2009-07-15 17:06:04 +0000
+++ b/debian/changelog	2009-07-15 20:48:37 +0000
@@ -2,6 +2,8 @@
 
   * Don't cause the commit to fail if the changelog file is present but
     unknown.
+  * Also avoid problems with SIGPIPE when running the build command.
+    (LP: #399938)
 
  -- James Westby <james.westby at ubuntu.com>  Wed, 15 Jul 2009 18:05:38 +0100
 



More information about the Pkg-bazaar-commits mailing list