Skip to content

Writing more than 4096 bytes to stdout results in deadlock on Windows #121

Closed
@kbknapp

Description

@kbknapp

The company I work for is using trycmd and we noticed our CI timing out on Windows. After some investigation, it appears writing more than 4096 bytes to stdout will result in trycmd deadlocking on Windows. This is presumably related to #45572 in Rust (std::process::Command hangs if piped stdout buffer fills) and makes sense since Windows uses a much smaller buffer than Linux.

A reproducible test case on Windows:

// src/main.rs
fn main() {
    // Change to 4096 and no deadlock appears
    for _ in 0..4097 {
        print!("a");
    }
}

A simple trycmd is all that it takes because we aren't looking for anything to actually pass or fail.

// tests/bug.rs
#[test]
fn trycmd_bug() {
    let t = trycmd::TestCases::new();
    t.cases("tests/bug.md");
}

In bug.md:

$ trycmd-bug
a

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugNot as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions