mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-11-08 09:09:17 +01:00
Set stdin to null when running the binary of an exercise
This commit is contained in:
parent
2ad408f2b8
commit
802b97b2ed
@ -10,7 +10,8 @@ use std::{
|
|||||||
pub fn run_cmd(mut cmd: Command, description: &str, output: Option<&mut Vec<u8>>) -> Result<bool> {
|
pub fn run_cmd(mut cmd: Command, description: &str, output: Option<&mut Vec<u8>>) -> Result<bool> {
|
||||||
let spawn = |mut cmd: Command| {
|
let spawn = |mut cmd: Command| {
|
||||||
// NOTE: The closure drops `cmd` which prevents a pipe deadlock.
|
// NOTE: The closure drops `cmd` which prevents a pipe deadlock.
|
||||||
cmd.spawn()
|
cmd.stdin(Stdio::null())
|
||||||
|
.spawn()
|
||||||
.with_context(|| format!("Failed to run the command `{description}`"))
|
.with_context(|| format!("Failed to run the command `{description}`"))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user