From ad10d61697cd852ee88963b4c2bc2911af78d4e9 Mon Sep 17 00:00:00 2001 From: quirinecker Date: Mon, 13 Mar 2023 01:18:26 +0100 Subject: [PATCH] fixed permission for the reveal install script --- src/app/commands/install_reveal.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/commands/install_reveal.rs b/src/app/commands/install_reveal.rs index 01569d0..149af37 100644 --- a/src/app/commands/install_reveal.rs +++ b/src/app/commands/install_reveal.rs @@ -1,14 +1,14 @@ -use std::{fs::File, io::Write}; +use std::{fs::{File, Permissions}, io::Write, os::unix::prelude::PermissionsExt}; use crate::app::fs_util; const ASCIIDOC_REVEAL_VERSION: &str= "v4.1.0-rc.5"; pub async fn install_reveal() -> () { - let result = reqwest::blocking::get(url()) + let result = reqwest::get(url()).await .expect("Could not download reveal. Make sure you are connected to the internet"); - let binary = result.bytes().expect("could not get binary"); + let binary = result.bytes().await.expect("could not get binary"); let home_path = home::home_dir().expect("could not find home dir"); let save_path = format!("{}/.docki/asciidoctor-revealjs", home_path.display()); @@ -17,6 +17,7 @@ pub async fn install_reveal() -> () { fs_util::create_dir_recursive(save_dir.as_str()); let mut file = File::create(save_path).expect("could not save binary"); + file.set_permissions(Permissions::from_mode(0o770)).expect("could not set permission"); file.write_all(&binary).expect("could not save binary"); }