Skip to content

Commit 6bb8c2f

Browse files
committed
Add test to verify stdin is closed for build.rs
1 parent 90da89b commit 6bb8c2f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/testsuite/build_script.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4905,3 +4905,27 @@ for more information about build script outputs.
49054905
)
49064906
.run();
49074907
}
4908+
4909+
#[cargo_test]
4910+
fn custom_build_closes_stdin() {
4911+
let p = project()
4912+
.file(
4913+
"Cargo.toml",
4914+
r#"
4915+
[package]
4916+
name = "foo"
4917+
version = "0.5.0"
4918+
build = "build.rs"
4919+
"#,
4920+
)
4921+
.file("src/main.rs", "fn main() {}")
4922+
.file(
4923+
"build.rs",
4924+
r#"fn main() {
4925+
let mut line = String::new();
4926+
std::io::stdin().read_line(&mut line).unwrap();
4927+
}"#,
4928+
)
4929+
.build();
4930+
p.cargo("build").run();
4931+
}

0 commit comments

Comments
 (0)