Skip to content

Commit 75a33ff

Browse files
cynarlabclaude
andcommitted
docs(proxy): say what the stdio drain guarantees in each of its three endings
Review follow-up on #859. The comment on trackStdioActivity said a counted chunk's lines have been forwarded; that holds for complete lines only (a trailing fragment waits in the line buffer for the pipe to close, #860). The drain's doc stated the output-before-exit order as a guarantee; it is one when the wait ends on the close, a measured expectation when it ends on silence, and neither at the backstop. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent cb1c9b1 commit 75a33ff

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

‎src/proxy/dap-proxy-worker.ts‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2436,7 +2436,10 @@ export class DapProxyWorker {
24362436
/**
24372437
* Count and time every chunk the adapter's stdio delivers (issue #856).
24382438
* Registered after the adapter manager's own 'data' listeners, so by the
2439-
* time a chunk is counted its lines have been forwarded.
2439+
* time a chunk is counted the complete lines in it have been forwarded. A
2440+
* trailing fragment with no newline is another matter: it stays in the
2441+
* manager's line buffer until the pipe closes, which for an adapter that
2442+
* outlives its debuggee is teardown — too late, now as before (issue #860).
24402443
*/
24412444
private trackStdioActivity(adapterProcess: ChildProcess): { chunks: number; lastChunkAt: number } {
24422445
const activity = { chunks: 0, lastChunkAt: 0 };
@@ -2453,9 +2456,12 @@ export class DapProxyWorker {
24532456
* Hold exited/terminated forwarding until adapter stdio has drained: a
24542457
* debuggee printing to a block-buffered pipe flushes everything at exit,
24552458
* milliseconds after the adapter's terminated event, and the SessionManager
2456-
* stops the proxy on terminated — dropping late messages. Stream 'data'
2457-
* fires before 'close' and IPC is FIFO, so waiting here guarantees the
2458-
* forwarded output reaches the session buffer first.
2459+
* stops the proxy on terminated — dropping late messages. When the wait
2460+
* ends on the pipes closing, the order is guaranteed: stream 'data' fires
2461+
* before 'close' and IPC is FIFO, so the forwarded output reaches the
2462+
* session buffer first. When it ends on silence the order rests on a
2463+
* measurement instead (ADAPTER_STDIO_QUIET_MS), and at the backstop on
2464+
* nothing.
24592465
*
24602466
* Drained means the pipes closed — or, for an adapter that outlives its
24612467
* debuggee and so never closes them when the program ends, that they went

0 commit comments

Comments
 (0)