pub fn write_script_file(script_path: &Path, content: &str) -> Result<()> {
    use std::fs;
    use std::os::unix::fs::PermissionsExt;

    // Create leading directories
    if let Some(dir) = script_path.parent() {
        fs::create_dir_all(dir).context("Create leading directories")?;
    }

    // Write content and make script executable
    write_to_file(script_path, content)?;
    fs::set_permissions(script_path, fs::Permissions::from_mode(0o755)).context("chmod +x")?;

    Ok(())
}
/// Create an executable script. The leading directories will automatically
/// created.
Create an executable script. The leading directories will automatically
created.
Create an executable script . The leading directories will automatically created .
pub fn write_script_file(script_path: &Path, content: &str) -> Result<()> {
    use std::fs;
    use std::os::unix::fs::PermissionsExt;
    // Create leading directories
    if let Some(dir) = script_path.parent() {
        fs::create_dir_all(dir).context("Create leading directories")?;
    }
    // Write content and make script executable
    write_to_file(script_path, content)?;
    fs::set_permissions(script_path, fs::Permissions::from_mode(0o755)).context("chmod +x")?;
    Ok(())
}
pub fn write_script_file ( script_path : & Path , content : & str ) -> Result < ( ) > { use std :: fs ; use std :: os :: unix :: fs :: PermissionsExt ; // Create leading directories if let Some ( dir ) = script_path . parent ( ) { fs :: create_dir_all ( dir ) . context ( " " ) ? ; } // Write content and make script executable write_to_file ( script_path , content ) ? ; fs :: set_permissions ( script_path , fs :: Permissions :: from_mode ( 0o755 ) ) . context ( " " ) ? ; Ok ( ( ) ) }
Create an executable script.
Create an executable script .
script_path
&Path
content
&str
script_path
&Path
content
&str