Make one more test

This commit is contained in:
jif-oai
2025-12-09 17:58:35 +00:00
parent 9234de41d9
commit 3a288edf1b
2 changed files with 22 additions and 4 deletions

View File

@@ -31,8 +31,25 @@ pub(crate) struct OutputBufferState {
impl OutputBufferState {
pub(super) fn push_chunk(&mut self, chunk: Vec<u8>) {
self.total_bytes = self.total_bytes.saturating_add(chunk.len());
self.chunks.push_back(chunk);
if chunk.is_empty() {
return;
}
// On Windows (especially with ConPTY) output can arrive in many tiny chunks.
// Coalesce them to avoid pathological behavior in drain/collect paths.
const MAX_COALESCED_CHUNK_BYTES: usize = 8_192;
let mut chunk = chunk;
let chunk_len = chunk.len();
self.total_bytes = self.total_bytes.saturating_add(chunk_len);
if let Some(tail) = self.chunks.back_mut()
&& tail.len().saturating_add(chunk_len) <= MAX_COALESCED_CHUNK_BYTES
{
tail.append(&mut chunk);
} else {
self.chunks.push_back(chunk);
}
let mut excess = self
.total_bytes

View File

@@ -2427,14 +2427,15 @@ async fn windows_unified_exec_write_stdin_strips_escapes() -> Result<()> {
} = builder.build(&server).await?;
let open_call_id = "windows-uexec-open-stdin";
let script = "$esc=[char]27; while ($true) { $line=[Console]::In.ReadLine(); if ($null -eq $line) { break }; Write-Output ($esc + '[31mUEXEC-WINDOWS-STDIN' + $esc + '[0m') }";
let open_args = json!({
"cmd": "powershell -NoLogo -NoProfile",
"cmd": script,
"yield_time_ms": 2_000,
});
let stdin_call_id = "windows-uexec-stdin-escapes";
let stdin_args = json!({
"chars": "Write-Output \"UEXEC-WINDOWS-STDIN\"\n",
"chars": "trigger\r\n",
"session_id": 1000,
"yield_time_ms": 5_000,
});