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

Fixes sea-orm-cli exit status #1402

Merged
merged 1 commit into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions sea-orm-cli/src/commands/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,11 @@ pub async fn run_generate_command(

// Format each of the files
for OutputFile { name, .. } in output.files.iter() {
Command::new("rustfmt")
.arg(dir.join(name))
.spawn()?
.wait()?;
let exit_status = Command::new("rustfmt").arg(dir.join(name)).status()?; // Get the status code
if !exit_status.success() {
// Propagate the error if any
return Err(format!("Fail to format file `{name}`").into());
}
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion sea-orm-cli/src/commands/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ pub fn run_migrate_command(
}
// Run migrator CLI on user's behalf
println!("Running `cargo {}`", args.join(" "));
Command::new("cargo").args(args).spawn()?.wait()?;
let exit_status = Command::new("cargo").args(args).status()?; // Get the status code
if !exit_status.success() {
// Propagate the error if any
return Err("Fail to run migration".into());
}
}
}

Expand Down