pub fn run_bridge_script(pkgbuild_path: &Path) -> Result<String, Error>
Expand description
Runs the alpm-pkgbuild-bridge
script, which exposes all relevant information of a
PKGBUILD
in a custom format.
Returns the output of that script as a String
.
§Examples
use std::{fs::File, io::Write};
use alpm_pkgbuild::bridge::run_bridge_script;
use tempfile::tempdir;
const TEST_FILE: &str = include_str!("../../tests/test_files/normal.pkgbuild");
// Create a temporary directory where we write the PKGBUILD to.
let temp_dir = tempdir()?;
let path = temp_dir.path().join("PKGBUILD");
let mut file = File::create(&path)?;
file.write_all(TEST_FILE.as_bytes());
// Call the bridge script on that path.
println!("{}", run_bridge_script(&path)?);
§Errors
Returns an error if
pkgbuild_path
does not exist,pkgbuild_path
does not have a file name,pkgbuild_path
is not a file,- or running the
alpm-pkgbuild-bridge
script fails.