]> granicus.if.org Git - python/commitdiff
Make kill_python a little more forgiving if it can't obtain a snapshot of module...
authorTrent Nelson <trent.nelson@snakebite.org>
Thu, 3 Apr 2008 20:00:08 +0000 (20:00 +0000)
committerTrent Nelson <trent.nelson@snakebite.org>
Thu, 3 Apr 2008 20:00:08 +0000 (20:00 +0000)
PCbuild/kill_python.c

index 7fd4d94ae54c5ceb823e66303926f16776e598f0..8ee22e826aa990af4fa0a68b03dda5294a86c87f 100644 (file)
@@ -118,11 +118,15 @@ main(int argc, char **argv)
 \r
         /* It's a python process, so figure out which directory it's in... */\r
         hsm = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pe.th32ProcessID);\r
-        if (hsm == INVALID_HANDLE_VALUE) {\r
-            printf("CreateToolhelp32Snapshot[3] failed: %d\n", GetLastError());\r
-            CloseHandle(hsp);\r
-            return 1;\r
-        }\r
+        if (hsm == INVALID_HANDLE_VALUE)\r
+            /* \r
+             * If our module snapshot fails (which will happen if we don't own\r
+             * the process), just ignore it and continue.  (It seems different\r
+             * versions of Windows return different values for GetLastError()\r
+             * in this situation; it's easier to just ignore it and move on vs.\r
+             * stopping the build for what could be a false positive.)\r
+             */\r
+             continue;\r
 \r
         if (!Module32FirstW(hsm, &me)) {\r
             printf("Module32FirstW[2] failed: %d\n", GetLastError());\r