Skip to content

Commit

Permalink
fix(cli): Make 'cargo foo.rs' behave like --manifest-path
Browse files Browse the repository at this point in the history
This mirrors the logic `ArgMatchesExt::root_manifest`
  • Loading branch information
epage committed Jun 15, 2023
1 parent eab5985 commit 2ef9466
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/bin/cargo/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,15 @@ pub fn exec_manifest_command(config: &Config, cmd: &str, args: &[OsString]) -> C
}

let manifest_path = Path::new(cmd);
let manifest_path = crate::util::try_canonicalize(manifest_path)?;
let manifest_path = cargo_util::paths::normalize_path(&manifest_path);
if !manifest_path.exists() {
return Err(
anyhow::anyhow!("manifest `{}` does not exist", manifest_path.display()).into(),
);
return Err(anyhow::format_err!(
"manifest path `{}` does not exist",
manifest_path.display()
)
.into());
}
let manifest_path = crate::util::try_canonicalize(manifest_path)?;
let mut ws = Workspace::new(&manifest_path, config)?;
if config.cli_unstable().avoid_dev_deps {
ws.set_require_optional_deps(false);
Expand Down

0 comments on commit 2ef9466

Please sign in to comment.