extension_cli: Don't propagate errors caused by trying to read Cargo.toml
(#9641)
This PR fixes an issue where the extension CLI would error if a `Cargo.toml` didn't exist when we were trying to check for its existence. Since we're just checking if it exists for the purposes of detecting a Rust extension, we can safely ignore the errors. Also improved the logging/error handling in a few spots to make other errors easier to troubleshoot in the future. Release Notes: - N/A
This commit is contained in:
parent
e20508f66c
commit
3831088251
2 changed files with 14 additions and 5 deletions
|
@ -81,18 +81,25 @@ impl ExtensionBuilder {
|
|||
);
|
||||
}
|
||||
|
||||
fs::create_dir_all(&self.cache_dir)?;
|
||||
fs::create_dir_all(&self.cache_dir).context("failed to create cache dir")?;
|
||||
|
||||
let cargo_toml_path = extension_dir.join("Cargo.toml");
|
||||
if extension_manifest.lib.kind == Some(ExtensionLibraryKind::Rust)
|
||||
|| fs::metadata(&cargo_toml_path)?.is_file()
|
||||
|| fs::metadata(&cargo_toml_path)
|
||||
.ok()
|
||||
.map(|metadata| metadata.is_file())
|
||||
.unwrap_or(false)
|
||||
{
|
||||
self.compile_rust_extension(extension_dir, options).await?;
|
||||
log::info!("compiling Rust extension {}", extension_dir.display());
|
||||
self.compile_rust_extension(extension_dir, options)
|
||||
.await
|
||||
.context("failed to compile Rust extension")?;
|
||||
}
|
||||
|
||||
for (grammar_name, grammar_metadata) in &extension_manifest.grammars {
|
||||
self.compile_grammar(extension_dir, grammar_name.as_ref(), grammar_metadata)
|
||||
.await?;
|
||||
.await
|
||||
.with_context(|| format!("failed to compile grammar '{grammar_name}'"))?;
|
||||
}
|
||||
|
||||
log::info!("finished compiling extension {}", extension_dir.display());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue