Skip to content

Commit b5bf287

Browse files
committed
Address stratakis' review
1 parent 81ebe07 commit b5bf287

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Lib/test/test_dtrace.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,13 @@ def create_process_group(*args, **kwargs):
6060

6161
def kill_process_group(proc):
6262
if USE_PROCESS_GROUP:
63-
os.killpg(proc.pid, signal.SIGKILL)
63+
try:
64+
os.killpg(proc.pid, signal.SIGKILL)
65+
except ProcessLookupError:
66+
pass
6467
else:
6568
proc.kill()
69+
proc.communicate() # Clean up
6670

6771

6872
class TraceBackend:
@@ -267,7 +271,6 @@ def assert_usable(self):
267271
stdout, stderr = proc.communicate(timeout=10)
268272
except subprocess.TimeoutExpired:
269273
kill_process_group(proc)
270-
proc.communicate() # Clean up
271274
raise unittest.SkipTest("bpftrace timed out during usability check")
272275
except OSError as e:
273276
raise unittest.SkipTest(f"bpftrace not available: {e}")

0 commit comments

Comments
 (0)