Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make mommy say what she tried to spawn~ #82

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ fn real_main() -> Result<i32, Box<dyn std::error::Error>> {
// "mommy" let "cargo mommy i mean mommy i mean mommy" work right~
let new_role = args.get(2);
let mean = args.get(1) == Some(&"mean".to_owned());
let i = args.get(0) == Some(&"i".to_owned());
let i = args.first() == Some(&"i".to_owned());
if i && mean {
if let Some(new_role) = new_role.cloned() {
// Ok at this point we're confident we got "i mean <new_role>"
Expand Down Expand Up @@ -158,10 +158,12 @@ fn real_main() -> Result<i32, Box<dyn std::error::Error>> {
}

// Time for mommy to call cargo~
let mut cmd = std::process::Command::new(cargo);
let mut cmd = std::process::Command::new(&cargo);
cmd.args(args)
.env(RECURSION_LIMIT_VAR, new_limit.to_string());
let status = cmd.status()?;
let status: std::process::ExitStatus = cmd.status().map_err(|err: std::io::Error| {
format!("{true_role} tried looking everywhere, but did not find `{cargo}`: {err}",)
})?;
let code = status.code().unwrap_or(1);
if is_quiet_mode_enabled(cmd.get_args()) {
return Ok(code);
Expand Down