Skip to content

Commit

Permalink
Add test to verify stdin is closed for build.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
arlosi committed Oct 10, 2022
1 parent 90da89b commit 6bb8c2f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/testsuite/build_script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4905,3 +4905,27 @@ for more information about build script outputs.
)
.run();
}

#[cargo_test]
fn custom_build_closes_stdin() {
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.5.0"
build = "build.rs"
"#,
)
.file("src/main.rs", "fn main() {}")
.file(
"build.rs",
r#"fn main() {
let mut line = String::new();
std::io::stdin().read_line(&mut line).unwrap();
}"#,
)
.build();
p.cargo("build").run();
}

0 comments on commit 6bb8c2f

Please sign in to comment.