fix: allow post_create on dx new to fail silently
This commit is contained in:
2 files changed
+6
-3
No files matched your search
@@ -81,7 +81,7 @@ impl Create {
|
|||||||
};
|
};
|
||||||
restore_cursor_on_sigint();
|
restore_cursor_on_sigint();
|
||||||
let path = cargo_generate::generate(args)?;
|
let path = cargo_generate::generate(args)?;
|
||||||
post_create(&path)?;
|
_ = post_create(&path);
|
||||||
Ok(StructuredOutput::Success)
|
Ok(StructuredOutput::Success)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -183,7 +183,10 @@ pub(crate) fn post_create(path: &Path) -> Result<()> {
|
|||||||
// 3. Format the `Cargo.toml` and `Dioxus.toml` files.
|
// 3. Format the `Cargo.toml` and `Dioxus.toml` files.
|
||||||
let toml_paths = [path.join("Cargo.toml"), path.join("Dioxus.toml")];
|
let toml_paths = [path.join("Cargo.toml"), path.join("Dioxus.toml")];
|
||||||
for toml_path in &toml_paths {
|
for toml_path in &toml_paths {
|
||||||
let toml = std::fs::read_to_string(toml_path)?;
|
let Ok(toml) = std::fs::read_to_string(toml_path) else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
|
||||||
let mut toml = toml.parse::<toml_edit::DocumentMut>().map_err(|e| {
|
let mut toml = toml.parse::<toml_edit::DocumentMut>().map_err(|e| {
|
||||||
anyhow::anyhow!(
|
anyhow::anyhow!(
|
||||||
"failed to parse toml at {}: {}",
|
"failed to parse toml at {}: {}",
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ impl Init {
|
|||||||
};
|
};
|
||||||
create::restore_cursor_on_sigint();
|
create::restore_cursor_on_sigint();
|
||||||
let path = cargo_generate::generate(args)?;
|
let path = cargo_generate::generate(args)?;
|
||||||
create::post_create(&path)?;
|
_ = create::post_create(&path);
|
||||||
Ok(StructuredOutput::Success)
|
Ok(StructuredOutput::Success)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user