Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix process shutdown on Android #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 17, 2024
Merged
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
4 changes: 2 additions & 2 deletions src/pytestshellutils/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def init_terminal(
except subprocess.TimeoutExpired:
# We're good
# Collect any child processes, though, this early there likely is none
with contextlib.suppress(psutil.NoSuchProcess):
with contextlib.suppress(psutil.NoSuchProcess, psutil.AccessDenied):
for child in psutil.Process(self._terminal.pid).children(
recursive=True
): # pragma: no cover
Expand Down Expand Up @@ -221,7 +221,7 @@ def _terminate(self) -> ProcessResult:
atexit.unregister(self.terminate)
log.info("Stopping %s", self.factory)
# Collect any child processes information before terminating the process
with contextlib.suppress(psutil.NoSuchProcess):
with contextlib.suppress(psutil.NoSuchProcess, psutil.AccessDenied):
for child in psutil.Process(self._terminal.pid).children(recursive=True):
if child not in self._children:
self._children.append(child)
Expand Down
Loading