Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,14 @@ def reader():
return result[0]


def _wait_for_process_exec(proc, name, timeout):
def _wait_for_process_exec(proc, timeout):
# Wait until a child process calls exec() to replace the forked process
# executable. Raise AssertionError on timeout.
# executable. Don't check the executable name: it can be a multicall
# binary such as /bin/busybox. Raise AssertionError on timeout.
parent_exe = os.readlink("/proc/self/exe")
for _ in sleeping_retry(timeout, max_delay=0.1):
exe = os.readlink(f"/proc/{proc.pid}/exe")
if os.path.basename(exe) == name:
if exe != parent_exe:
break


Expand Down Expand Up @@ -625,7 +627,7 @@ def test_is_python_process_non_python_subprocess(self):
)

try:
_wait_for_process_exec(proc, "sleep", SHORT_TIMEOUT)
_wait_for_process_exec(proc, SHORT_TIMEOUT)

self.assertFalse(
is_python_process(proc.pid),
Expand Down
Loading