Skip to content

Commit 251c877

Browse files
branchseerclaude
andcommitted
fix: pty_terminal boundary spanning test on Windows ConPTY
ConPTY reprocesses output and inserts escape sequences between individually-printed characters, so "abcd" never appears contiguous in the raw PTY stream. Print the full string at once instead — boundary spanning is still tested since the reader can return partial data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ebc4b1b commit 251c877

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

crates/pty_terminal/tests/terminal.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@ fn read_until_with_read_to_end() {
9696
#[timeout(5000)]
9797
#[expect(clippy::print_stdout, reason = "subprocess test output")]
9898
fn read_until_boundary_spanning() {
99-
// Test case where expected string might span across read boundaries
99+
// Test that read_until works when the expected string may span across read() boundaries.
100+
// Boundary spanning is about the reader side: the PTY reader may return partial data even
101+
// from a single write. We print the full string at once because on Windows, ConPTY
102+
// reprocesses output and can insert escape sequences between individually-printed characters.
100103
let cmd = CommandBuilder::from(command_for_fn!((), |(): ()| {
101-
// Write in small chunks to increase chance of boundary spanning
102-
for c in ['a', 'b', 'c', 'd', 'e', 'f'] {
103-
print!("{c}");
104-
let _ = stdout().flush();
105-
}
104+
print!("abcdef");
105+
let _ = stdout().flush();
106106
}));
107107

108108
let mut terminal = Terminal::spawn(ScreenSize { rows: 80, cols: 80 }, cmd).unwrap();

0 commit comments

Comments
 (0)