Skip to content
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

Shell constructor hangs on ubuntu #59

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ source = shell_logger

[report]
skip_covered = False
fail_under = 80
fail_under = 0
show_missing = True
exclude_lines =
pragma: no cover
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defaults:

jobs:
test:
runs-on: macos-latest
runs-on: ubuntu-latest
strategy:
matrix:
version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
Expand All @@ -35,6 +35,7 @@ jobs:
-r doc/requirements.txt \
-r example/requirements.txt \
-r test/requirements.txt
python3 -m pip install snoop

- name: Test install
run: python3 -m pip install .
Expand All @@ -44,7 +45,7 @@ jobs:
with:
timeout_minutes: 10
max_attempts: 3
command: python3 -m pytest --verbose --cov=shell_logger test/
command: python3 -m pytest -s --verbose --cov=shell_logger test/

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
Expand Down
7 changes: 7 additions & 0 deletions shell_logger/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
from types import SimpleNamespace
from typing import IO, List, Optional, TextIO, Tuple

import snoop


END_OF_READ = 4

Expand All @@ -44,6 +46,7 @@ class Shell:
with the shell.
"""

@snoop
def __init__(
self, pwd: Optional[Path] = None, *, login_shell: bool = False
) -> None:
Expand Down Expand Up @@ -145,6 +148,7 @@ def pwd(self) -> str:
directory, _ = self.auxiliary_command(posix="pwd", strip=True)
return directory

@snoop
def cd(self, path: Path) -> None:
"""
Change to the given directory.
Expand Down Expand Up @@ -318,6 +322,7 @@ def write(input_file: TextIO, output_files: List[TextIO]) -> None:
file.close()
return SimpleNamespace(stdout_str=stdout_str, stderr_str=stderr_str)

@snoop
def auxiliary_command(
self, **kwargs
) -> Tuple[Optional[str], Optional[str]]:
Expand Down Expand Up @@ -351,6 +356,8 @@ def auxiliary_command(
stderr = ""

max_anonymous_pipe_buffer_size = 65536

# This next line is where the hang occurs.
aux = os.read(self.aux_stdout_rfd, max_anonymous_pipe_buffer_size)
while aux[-1] != END_OF_READ:
stdout += aux.decode()
Expand Down
3 changes: 3 additions & 0 deletions shell_logger/shell_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
from types import SimpleNamespace
from typing import Iterator, List, Optional, Union

import snoop

from .html_utilities import (
append_html,
child_logger_card,
Expand Down Expand Up @@ -130,6 +132,7 @@ def append(path: Path) -> ShellLogger:
with path.open("r") as jf:
return json.load(jf, cls=ShellLoggerDecoder)

@snoop
def __init__( # noqa: PLR0913
self,
name: str,
Expand Down
Loading
Loading