Fixed sea-orm-cli exit status (#1402)
This commit is contained in:
parent
e6206c9143
commit
9c6e5c1fa2
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user