[Piglit] [PATCH] framework/test/base: Pass None preexec_fn on Windows.

jfonseca at vmware.com jfonseca at vmware.com
Thu Nov 20 04:45:30 PST 2014


From: José Fonseca <jfonseca at vmware.com>

Otherwise subprocess will raise "preexec_fn is not supported on Windows
platforms" ValueError exception.
---
 framework/test/base.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/framework/test/base.py b/framework/test/base.py
index c3234d6..7aab45f 100644
--- a/framework/test/base.py
+++ b/framework/test/base.py
@@ -283,6 +283,12 @@ class Test(object):
                                           self.env.iteritems()):
             fullenv[key] = str(value)
 
+        # preexec_fn is not supported on Windows platforms
+        if sys.platform == 'win32':
+            preexec_fn = None
+        else:
+            preexec_fn = self.__set_process_group
+
         try:
             proc = subprocess.Popen(self.command,
                                     stdout=subprocess.PIPE,
@@ -290,7 +296,7 @@ class Test(object):
                                     cwd=self.cwd,
                                     env=fullenv,
                                     universal_newlines=True,
-                                    preexec_fn=self.__set_process_group)
+                                    preexec_fn=preexec_fn)
             # create a ProcessTimeout object to watch out for test hang if the
             # process is still going after the timeout, then it will be killed
             # forcing the communicate function (which is a blocking call) to
-- 
1.9.1



More information about the Piglit mailing list