diff --git a/src/viztracer/main.py b/src/viztracer/main.py index ab6cf210..f2dcbe90 100644 --- a/src/viztracer/main.py +++ b/src/viztracer/main.py @@ -600,7 +600,7 @@ def wait_children_finish(self) -> None: if pid_exists(pid): break else: # pragma: no cover - color_print("WARNING", f"Can't parse {viztmp_file}, skip") + color_print("WARNING", f"Unknown viztmp file {viztmp_file}") else: break time.sleep(0.5) diff --git a/src/viztracer/util.py b/src/viztracer/util.py index a1b5e31d..875d65c7 100644 --- a/src/viztracer/util.py +++ b/src/viztracer/util.py @@ -118,8 +118,8 @@ def pid_exists(pid): # On Windows, 0 is an idle process buw we don't need to # check it here raise ValueError('invalid PID 0') - # Windows if sys.platform == "win32": + # Windows kernel32 = ctypes.windll.kernel32 process = kernel32.OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, 0, pid) @@ -153,8 +153,8 @@ def pid_exists(pid): # Usually it's impossible to run here in viztracer. return True return False # pragma: no cover - # UNIX else: + # UNIX try: os.kill(pid, 0) except OSError as err: diff --git a/tests/test_regression.py b/tests/test_regression.py index 43f292e1..82481fe8 100644 --- a/tests/test_regression.py +++ b/tests/test_regression.py @@ -398,7 +398,7 @@ def target(): p.start() # The main process will join the child in multiprocessing.process._children. # This is a hack to make sure the main process won't join the child process, - # so we can test the wait_children_finish function + # so we can test the VizUI.wait_children_finish function multiprocessing.process._children = set() time.sleep(1) """ @@ -418,7 +418,7 @@ def target(): p.start() # The main process will join the child in multiprocessing.process._children. # This is a hack to make sure the main process won't join the child process, - # so we can test the wait_children_finish function + # so we can test the VizUI.wait_children_finish function multiprocessing.process._children = set() time.sleep(1) """