Commits

Ronny Pfannschmidt committed 0417a79

shuffle opening the log output around

Comments (0)

Files changed (2)

testrunner/runner.py

 def execute_test(cwd, test, out, logfname, interp, test_driver,
                  runfunc, timeout=None):
     args = execute_args(cwd, test, logfname, interp, test_driver)
-    exitcode = runfunc(args, cwd, out, timeout=timeout)
+    with out.open('w') as fp:
+        exitcode = runfunc(args, cwd, fp, timeout=timeout)
     return exitcode
 
 

testrunner/util.py

 
 
 def run(args, cwd, out, timeout=None):
-    with out.open('w') as f:
-        try:
-            p = subprocess.Popen(args, cwd=str(cwd), stdout=f, stderr=f)
-        except Exception, e:
-            f.write("Failed to run %s with cwd='%s' timeout=%s:\n"
-                    " %s\n"
-                    % (args, cwd, timeout, e))
-            return RUNFAILED
+    try:
+        p = subprocess.Popen(args, cwd=str(cwd), stdout=f, stderr=f)
+    except Exception, e:
+        f.write("Failed to run %s with cwd='%s' timeout=%s:\n"
+                " %s\n"
+                % (args, cwd, timeout, e))
+        return RUNFAILED
 
-        if timeout is None:
-            return p.wait()
-        else:
-            returncode = busywait(p, timeout)
-            if returncode is not None:
-                return returncode
-            # timeout!
-            _kill(p.pid, SIGTERM)
-            if busywait(p, 10) is None:
-                _kill(p.pid, SIGKILL)
-            return TIMEDOUT
+    if timeout is None:
+        return p.wait()
+    else:
+        returncode = busywait(p, timeout)
+        if returncode is not None:
+            return returncode
+        # timeout!
+        _kill(p.pid, SIGTERM)
+        if busywait(p, 10) is None:
+            _kill(p.pid, SIGKILL)
+        return TIMEDOUT
 
 
 def dry_run(args, cwd, out, timeout=None):
-    with out.open('w') as f:
-        f.write("run %s with cwd='%s' timeout=%s\n" % (args, cwd, timeout))
+    out.write("run %s with cwd='%s' timeout=%s\n" % (args, cwd, timeout))
     return 0
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.