← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~mwilck/duplicity/0.7-series into lp:duplicity/0.7-series

 

Martin Wilck has proposed merging lp:~mwilck/duplicity/0.7-series into lp:duplicity/0.7-series.

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~mwilck/duplicity/0.7-series/+merge/301492

Fix the regression on Trusty.
-- 
Your team duplicity-team is requested to review the proposed merge of lp:~mwilck/duplicity/0.7-series into lp:duplicity/0.7-series.
=== modified file 'testing/functional/__init__.py'
--- testing/functional/__init__.py	2016-07-28 15:34:42 +0000
+++ testing/functional/__init__.py	2016-07-29 13:50:55 +0000
@@ -39,6 +39,24 @@
 
 class FunctionalTestCase(DuplicityTestCase):
 
+    _setsid_w = None
+
+    @classmethod
+    def _check_setsid(cls):
+        if cls._setsid_w is not None:
+            return
+        if platform.platform().startswith('Linux'):
+            # setsid behavior differs between distributions.
+            # If setsid supports -w ("wait"), use it.
+            import subprocess
+            try:
+                with open("/dev/null", "w") as sink:
+                    subprocess.check_call(["setsid", "-w", "ls"], stdout=sink, stderr=sink)
+            except subprocess.CalledProcessError:
+                cls._setsid_w = False
+            else:
+                cls._setsid_w = True
+
     def setUp(self):
         super(FunctionalTestCase, self).setUp()
 
@@ -55,6 +73,7 @@
         if bl:
             backend_inst.delete(backend_inst.list())
         backend_inst.close()
+        self._check_setsid()
 
     def run_duplicity(self, options=[], current_time=None, fail=None,
                       passphrase_input=[]):
@@ -65,7 +84,13 @@
         # this way we force a failure if duplicity tries to read from the
         # console unexpectedly (like for gpg password or such).
         if platform.platform().startswith('Linux'):
-            cmd_list = ['setsid']
+<<<<<<< TREE
+            cmd_list = ['setsid']
+=======
+            cmd_list = ['setsid']
+            if self._setsid_w:
+                cmd_list.extend(["-w"])
+>>>>>>> MERGE-SOURCE
         else:
             cmd_list = []
         cmd_list.extend(["duplicity"])