diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 6efaf32..4b553e6 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -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 . diff --git a/shell_logger/shell.py b/shell_logger/shell.py index de47d3c..3ce9a3b 100644 --- a/shell_logger/shell.py +++ b/shell_logger/shell.py @@ -20,6 +20,8 @@ from types import SimpleNamespace from typing import IO, List, Optional, TextIO, Tuple +import snoop + END_OF_READ = 4 @@ -44,6 +46,7 @@ class Shell: with the shell. """ + @snoop def __init__( self, pwd: Optional[Path] = None, *, login_shell: bool = False ) -> None: @@ -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. @@ -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]]: @@ -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() diff --git a/shell_logger/shell_logger.py b/shell_logger/shell_logger.py index 25a1278..6f92b90 100644 --- a/shell_logger/shell_logger.py +++ b/shell_logger/shell_logger.py @@ -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, @@ -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,