1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2025-07-03 00:46:57 +02:00

Make cargo run work

This commit is contained in:
mo8it
2024-04-01 02:11:52 +02:00
parent 8ad18de54c
commit 14f3585816
6 changed files with 214 additions and 4 deletions

View File

@ -91,9 +91,17 @@ pub struct ContextLine {
impl Exercise {
fn cargo_cmd(&self, command: &str, args: &[&str]) -> Result<Output> {
Command::new("cargo")
.arg(command)
.arg("--color")
let mut cmd = Command::new("cargo");
cmd.arg(command);
// A hack to make `cargo run` work when developing Rustlings.
// Use `dev/Cargo.toml` when in the directory of the repository.
#[cfg(debug_assertions)]
if std::path::Path::new("tests").exists() {
cmd.arg("--manifest-path").arg("dev/Cargo.toml");
}
cmd.arg("--color")
.arg("always")
.arg("-q")
.arg("--bin")