[infra] Clean up task killing on Windows.

Currently task_kill attempts to kill "No" process when no processes with given name are found. For example https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8725661622744325729/+/u/kill_processes__2_/stdout

Follow-up to 86c395967982993fb045d34f43df5b3cefbf5366

Change-Id: I7e76f2ad6351ede530f4d4b0760e47bfacb1476b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404722
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
diff --git a/tools/task_kill.py b/tools/task_kill.py
index 76fd458..46a5bf5 100755
--- a/tools/task_kill.py
+++ b/tools/task_kill.py
@@ -127,9 +127,20 @@
 
 
 def GetPidsWindows(process_name):
-    cmd = 'tasklist /FI "IMAGENAME eq %s" /NH' % process_name
+    cmd = 'tasklist /fo list /FI "IMAGENAME eq %s"' % process_name
     # Sample output:
-    # dart.exe    4356 Console            1      6,800 K
+    #   Image Name:   dart.exe
+    #   PID:          26568
+    #   Session Name: Console
+    #   Session#:     1
+    #   Mem Usage:    130,236 K
+    #
+    #   Image Name:   dart.exe
+    #   PID:          22424
+    #   Session Name: Console
+    #   Session#:     1
+    #   Mem Usage:    280,776 K
+
     p = subprocess.Popen(cmd,
                          stdout=subprocess.PIPE,
                          stderr=subprocess.PIPE,
@@ -140,9 +151,9 @@
     lines = output.splitlines()
 
     for line in lines:
-        split = line.split()
-        if len(split) > 2:
-            results.append(split[1])
+        split = line.split(':')
+        if (len(split) == 2) and (split[0].strip() == 'PID'):
+            results.append(split[1].strip())
     return results