[CalendarServer-changes] [15263] twext/trunk/twext/python/test/test_launchd.py

source_changes at macosforge.org source_changes at macosforge.org
Mon Nov 2 08:13:23 PST 2015


Revision: 15263
          http://trac.calendarserver.org//changeset/15263
Author:   cdaboo at apple.com
Date:     2015-11-02 08:13:23 -0800 (Mon, 02 Nov 2015)
Log Message:
-----------
Another launchd fix attempt.

Modified Paths:
--------------
    twext/trunk/twext/python/test/test_launchd.py

Modified: twext/trunk/twext/python/test/test_launchd.py
===================================================================
--- twext/trunk/twext/python/test/test_launchd.py	2015-10-30 21:01:06 UTC (rev 15262)
+++ twext/trunk/twext/python/test/test_launchd.py	2015-11-02 16:13:23 UTC (rev 15263)
@@ -18,6 +18,7 @@
 Tests for L{twext.python.launchd}.
 """
 
+from subprocess import Popen, PIPE
 import json
 import os
 import plistlib
@@ -91,13 +92,22 @@
                 "Awesome": [{"SecureSocketWithKey": "GeneratedSocket"}]
             },
             "RunAtLoad": True,
+            "Debug": True,
         }
         self.job = fp.child("job.plist")
         self.job.setContent(plistlib.writePlistToString(plist))
-        err = os.spawnlp(os.P_WAIT, "launchctl", "launchctl", "load", self.job.path)
-        if err != 0 or os.path.exists(self.stderr.path):
-            # This happens when running in headless mode (e.g., buildbot) and is due to
-            # permission restrictions. Just skip the test.
+
+        child = Popen(
+            args=[
+                "launchctl",
+                "load",
+                self.job.path,
+            ],
+            stdout=PIPE, stderr=PIPE,
+        )
+        _ignore_output, error = child.communicate()
+
+        if child.returncode != 0 or error:
             raise SkipTest("launchctl cannot run on this system")
 
         return d
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20151102/9286ee5e/attachment.html>


More information about the calendarserver-changes mailing list