From daa8329baaa9b3adc2178efa74971729cf88bad1 Mon Sep 17 00:00:00 2001 From: Ed Bordin Date: Sat, 8 Aug 2020 15:35:51 +1000 Subject: [PATCH] minor fixes after testing --- sbysrc/win_killpg.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sbysrc/win_killpg.py b/sbysrc/win_killpg.py index cfd7c3a..d6b96b5 100644 --- a/sbysrc/win_killpg.py +++ b/sbysrc/win_killpg.py @@ -61,7 +61,7 @@ def _create_process_lookup(): pe = pointer(PROCESSENTRY32()) pe.contents.dwSize = sizeof(PROCESSENTRY32) pid_lookup = {} - if windll.kernel32. (handle, pe) != 0: + if windll.kernel32.Process32First(handle, pe) != 0: _update_lookup(pid_lookup, pe) while windll.kernel32.Process32Next(handle, pe) != 0: _update_lookup(pid_lookup, pe) @@ -83,6 +83,6 @@ def win_killpg(pid): try: # "Any other value for sig will cause the process to be # unconditionally killed by the TerminateProcess API" - os.kill(p, sig=-1) - except PermissionError as pe: - print("WARNING: error while killing pid {}: {}".format(p, pe)) + os.kill(p, -1) + except (PermissionError, OSError) as e: + print("WARNING: error while killing pid {}: {}".format(p, e))