You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5dfec6e
Browse filesBrowse the repository at this point in the historyBrowse files
authored
fix(proxy): forward a program's last line without a newline before its exit on Windows (#860) (#869)
On Windows the debuggee of a CodeLLDB-based adapter (rust, cpp, cobol)
writes into the adapter's stdio pipes, and GenericAdapterManager splits
that stream into lines with a LineBuffer: complete lines are forwarded as
they arrive, the trailing fragment on the stream's end/close. CodeLLDB
keeps its pipes open until teardown, so a last line printed without a
newline was flushed after exited/terminated had been forwarded and the
session had stopped listening — `result: 42` never reached get_output.
AdapterSpawnResult gains an optional flushStdio(): the early flush of both
stdio line buffers, delivering what they hold through onStdioLine marked
`{ partial: true }`. The worker keeps it for an adapter that outlives its
debuggee and runs it when waitForAdapterStdioDrain settles — on the
measured quiet window or the backstop (#856) — before every caller
forwards its terminal signal, so the fragment lands ahead of exited on
the FIFO IPC channel. The forwarder leaves a partial line without the
'\n' it restores for complete lines: the fragment arrives as printed. When
the pipes did close, the manager's own close flush ran first and the early
flush finds nothing; rdbg (pipes close with the program) is unchanged.
Measured on Windows 11 through the dev server, cpp adapter: before,
get_output ended at `first line\n`; after, `result: 42` follows 103 ms
later (the quiet window), with no added newline, and a 2000-char stdout
fragment plus a stderr fragment arrive intact with exit code 3.
Co-authored-by: JF <john.franklin@gmail.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
**On Windows, a Rust, C/C++ or COBOL program's last line reaches `get_output` even when it has no newline** — the debuggee writes into CodeLLDB's stdio pipes there, and the proxy splits that stream into lines, flushing a trailing fragment only when the pipe closes. CodeLLDB keeps its pipes open until the session is torn down, so a program whose final `printf("result: 42")` had no newline lost that text: the flush came after the exit had been reported and the session had stopped listening. For an adapter that outlives its debuggee the proxy now hands the fragment over when its exit-time drain settles on the pipes going quiet (#856) — before `exited` is forwarded, through the same path as a complete line, and as printed: no newline is added that the program never wrote. Adapters whose pipes close with the program (rdbg) are unchanged (#860)
0 commit comments