Skip to content

Commit 07dec76

Browse files
authored
Merge pull request #1916 from mo8it/command
Pipe the output of command to null instead of capturing and ignoring it
2 parents deeefcf + d911586 commit 07dec76

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/exercise.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::fmt::{self, Display, Formatter};
55
use std::fs::{self, remove_file, File};
66
use std::io::Read;
77
use std::path::PathBuf;
8-
use std::process::{self, Command};
8+
use std::process::{self, Command, Stdio};
99

1010
const RUSTC_COLOR_ARGS: &[&str] = &["--color", "always"];
1111
const RUSTC_EDITION_ARGS: &[&str] = &["--edition", "2021"];
@@ -148,7 +148,10 @@ path = "{}.rs""#,
148148
.args(RUSTC_COLOR_ARGS)
149149
.args(RUSTC_EDITION_ARGS)
150150
.args(RUSTC_NO_DEBUG_ARGS)
151-
.output()
151+
.stdin(Stdio::null())
152+
.stdout(Stdio::null())
153+
.stderr(Stdio::null())
154+
.status()
152155
.expect("Failed to compile!");
153156
// Due to an issue with Clippy, a cargo clean is required to catch all lints.
154157
// See https://github.com/rust-lang/rust-clippy/issues/2604
@@ -157,7 +160,10 @@ path = "{}.rs""#,
157160
Command::new("cargo")
158161
.args(["clean", "--manifest-path", CLIPPY_CARGO_TOML_PATH])
159162
.args(RUSTC_COLOR_ARGS)
160-
.output()
163+
.stdin(Stdio::null())
164+
.stdout(Stdio::null())
165+
.stderr(Stdio::null())
166+
.status()
161167
.expect("Failed to run 'cargo clean'");
162168
Command::new("cargo")
163169
.args(["clippy", "--manifest-path", CLIPPY_CARGO_TOML_PATH])

0 commit comments

Comments
 (0)