~kmaasrud/djoc

4adf36c0781d216a3279e4288175d85109e95a1d — kmaasrud 5 months ago 932fcc1
fix: skip non-parsable manifests
1 files changed, 6 insertions(+), 5 deletions(-)

M src/cli/build.rs
M src/cli/build.rs => src/cli/build.rs +6 -5
@@ 12,9 12,10 @@ pub fn build() -> Result<()> {
                .map(|ext| ext.to_string_lossy() == "toml")
                .unwrap_or_default()
        })
        .try_for_each(|path| {
            let manifest: Manifest = toml::from_str(&fs::read_to_string(path)?)?;
            manifest.execute()?;
            Ok(())
        })
        // NOTE: A TOML file must be UTF-8, but should we perhaps throw an error if any file is not
        // UTF-8? That might be less confusing for users.
        .filter_map(|path| toml::from_str(&fs::read_to_string(path).ok()?).ok())
        .try_for_each(|manifest: Manifest| manifest.execute())?;

    Ok(())
}