Skip to content

Commit 1de571a

Browse files
committed
chore: Snoop on the constructor
1 parent f777faf commit 1de571a

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

.github/workflows/continuous-integration.yml

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
-r doc/requirements.txt \
3636
-r example/requirements.txt \
3737
-r test/requirements.txt
38+
python3 -m pip install snoop
3839
3940
- name: Test install
4041
run: python3 -m pip install .

shell_logger/shell.py

+7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
from types import SimpleNamespace
2121
from typing import IO, List, Optional, TextIO, Tuple
2222

23+
import snoop
24+
2325

2426
END_OF_READ = 4
2527

@@ -44,6 +46,7 @@ class Shell:
4446
with the shell.
4547
"""
4648

49+
@snoop
4750
def __init__(
4851
self, pwd: Optional[Path] = None, *, login_shell: bool = False
4952
) -> None:
@@ -145,6 +148,7 @@ def pwd(self) -> str:
145148
directory, _ = self.auxiliary_command(posix="pwd", strip=True)
146149
return directory
147150

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

325+
@snoop
321326
def auxiliary_command(
322327
self, **kwargs
323328
) -> Tuple[Optional[str], Optional[str]]:
@@ -351,6 +356,8 @@ def auxiliary_command(
351356
stderr = ""
352357

353358
max_anonymous_pipe_buffer_size = 65536
359+
360+
# This next line is where the hang occurs.
354361
aux = os.read(self.aux_stdout_rfd, max_anonymous_pipe_buffer_size)
355362
while aux[-1] != END_OF_READ:
356363
stdout += aux.decode()

shell_logger/shell_logger.py

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
from types import SimpleNamespace
2222
from typing import Iterator, List, Optional, Union
2323

24+
import snoop
25+
2426
from .html_utilities import (
2527
append_html,
2628
child_logger_card,
@@ -130,6 +132,7 @@ def append(path: Path) -> ShellLogger:
130132
with path.open("r") as jf:
131133
return json.load(jf, cls=ShellLoggerDecoder)
132134

135+
@snoop
133136
def __init__( # noqa: PLR0913
134137
self,
135138
name: str,

0 commit comments

Comments
 (0)