taskkill mspdbsrv after compile on Windows

Change-Id: I951cec207aaa3f50a273b584a2f83461216fee5a
Reviewed-on: https://gn-review.googlesource.com/1642
Reviewed-by: Petr Hosek <phosek@google.com>
Commit-Queue: Scott Graham <scottmg@chromium.org>
diff --git a/infra/recipes/gn.expected/ci_win.json b/infra/recipes/gn.expected/ci_win.json
index cb832c3..1a6f953 100644
--- a/infra/recipes/gn.expected/ci_win.json
+++ b/infra/recipes/gn.expected/ci_win.json
@@ -201,6 +201,19 @@
   },
   {
     "cmd": [
+      "taskkill.exe",
+      "/f",
+      "/t",
+      "/im",
+      "mspdbsrv.exe"
+    ],
+    "name": "debug.build.taskkill mspdbsrv",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
       "[START_DIR]\\gn\\out\\gn_unittests"
     ],
     "name": "debug.build.test",
@@ -265,6 +278,19 @@
   },
   {
     "cmd": [
+      "taskkill.exe",
+      "/f",
+      "/t",
+      "/im",
+      "mspdbsrv.exe"
+    ],
+    "name": "release.build.taskkill mspdbsrv",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
       "[START_DIR]\\gn\\out\\gn_unittests"
     ],
     "name": "release.build.test",
diff --git a/infra/recipes/gn.expected/cq_win.json b/infra/recipes/gn.expected/cq_win.json
index 3329ec0..79189fd 100644
--- a/infra/recipes/gn.expected/cq_win.json
+++ b/infra/recipes/gn.expected/cq_win.json
@@ -228,6 +228,19 @@
   },
   {
     "cmd": [
+      "taskkill.exe",
+      "/f",
+      "/t",
+      "/im",
+      "mspdbsrv.exe"
+    ],
+    "name": "debug.build.taskkill mspdbsrv",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
       "[START_DIR]\\gn\\out\\gn_unittests"
     ],
     "name": "debug.build.test",
@@ -292,6 +305,19 @@
   },
   {
     "cmd": [
+      "taskkill.exe",
+      "/f",
+      "/t",
+      "/im",
+      "mspdbsrv.exe"
+    ],
+    "name": "release.build.taskkill mspdbsrv",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
       "[START_DIR]\\gn\\out\\gn_unittests"
     ],
     "name": "release.build.test",
diff --git a/infra/recipes/gn.py b/infra/recipes/gn.py
index f234e27..de00c2b 100644
--- a/infra/recipes/gn.py
+++ b/infra/recipes/gn.py
@@ -127,6 +127,12 @@
           # Windows requires the environment modifications when building too.
           api.step('ninja', [cipd_dir.join('ninja'), '-C', src_dir.join('out')])
 
+        if api.platform.name == 'win':
+          # Swarming won't be able to tidy up after the compiler leaves this
+          # daemon running, so we have to manually kill it.
+          api.step('taskkill mspdbsrv',
+                   ['taskkill.exe', '/f', '/t', '/im', 'mspdbsrv.exe'])
+
         api.step('test', [src_dir.join('out', 'gn_unittests')])