Skip to content
Merged
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: 2 additions & 0 deletions debugger/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tool.mypy]
check_untyped_defs = true
6 changes: 5 additions & 1 deletion debugger/src/debugger/base_debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,21 @@ async def init(self, executable_path: str) -> None:
os.ttyname(self.fd_slave),
"--args",
str(executable_path),
# use pipes so Process.stdin and Process.stdout are not None
# https://docs.python.org/3/library/asyncio-subprocess.html#asyncio.subprocess.Process.stdin
stdin=PIPE,
stdout=PIPE,
)

create_task(self._stdout_dispatch())
create_task(self._inf_dispatch())
self._did_init = True
return self

async def deinit(self) -> None:
if not self._did_init:
return

assert self.process.stdin is not None
self.process.stdin.write_eof()
await self.process.stdin.drain()
await self.process.wait()
Expand All @@ -80,6 +82,7 @@ async def deinit(self) -> None:
async def run_command(self, command: str):
chan = self._inflight_cmds.make_chan()

assert self.process.stdin is not None
self.process.stdin.write(f"{chan}{command}\n".encode())
await self.process.stdin.drain()

Expand Down Expand Up @@ -120,6 +123,7 @@ def on_inf(self, func: Callable[[str], None]):
self._inferior_handler = _asyncify(func)

async def _stdout_dispatch(self) -> None:
assert self.process.stdout is not None
while line := await self.process.stdout.readline():
for resp in mi.parse(line):
match resp:
Expand Down
Loading