[test] More debugging output in test runner.
authormachenbach <machenbach@chromium.org>
Fri, 12 Jun 2015 13:43:52 +0000 (06:43 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 12 Jun 2015 13:43:57 +0000 (13:43 +0000)
Also use again the taskkill method, recently removed in
https://codereview.chromium.org/1156133006/

BUG=chromium:485932
LOG=n
TBR=jkummerow@chromium.org
NOTREECHECKS=true

Review URL: https://codereview.chromium.org/1177903005

Cr-Commit-Position: refs/heads/master@{#29001}

tools/testrunner/local/commands.py

index 4d74165..6aac3ff 100644 (file)
@@ -26,8 +26,8 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
-import os
 import subprocess
+import sys
 from threading import Timer
 
 from ..local import utils
@@ -73,7 +73,24 @@ def RunProcess(verbose, timeout, args, **rest):
   def kill_process(process, timeout_result):
     timeout_result[0] = True
     try:
-      process.kill()
+      if utils.IsWindows():
+        if verbose:
+          print "Attempting to kill process %d" % process.pid
+          sys.stdout.flush()
+        tk = subprocess.Popen(
+            'taskkill /T /F /PID %d' % process.pid,
+            stdout=subprocess.PIPE,
+            stderr=subprocess.PIPE,
+        )
+        stdout, stderr = tk.communicate()
+        if verbose:
+          print "Taskkill results for %d" % process.pid
+          print stdout
+          print stderr
+          print "Return code: %d" % tk.returncode
+          sys.stdout.flush()
+      else:
+        process.kill()
     except OSError:
       sys.stderr.write('Error: Process %s already ended.\n' % process.pid)