Skip to content

Commit

Permalink
修复Linux下的编译错误
Browse files Browse the repository at this point in the history
  • Loading branch information
czy-29 committed Sep 11, 2024
1 parent e355daa commit 50a0917
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src/ops/caddy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,7 @@ pub async fn upgrade(config: &Config) -> Result<(), anyhow::Error> {
fs::write(&path, contents).await?;

#[cfg(not(windows))]
chmod_exec(path).await?;

#[cfg(not(windows))]
use super::super::spawn_command;
crate::utils::chmod_exec(path).await?;

#[cfg(not(windows))]
{
Expand Down
2 changes: 1 addition & 1 deletion src/ops/hugo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ impl Hugo {
fs::write(&path, contents).await?;

#[cfg(not(windows))]
chmod_exec(path).await?;
crate::utils::chmod_exec(path).await?;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub fn unzip(z: &[u8], e_name: &str) -> Result<(OsString, Vec<u8>), anyhow::Erro
pub async fn chmod_exec(path: impl AsRef<std::path::Path>) -> Result<(), anyhow::Error> {
tracing::info!("正在设置执行权限……");
use std::{fs::Permissions, os::unix::prelude::PermissionsExt};
Ok(fs::set_permissions(path, Permissions::from_mode(0o755)).await?)
Ok(tokio::fs::set_permissions(path, Permissions::from_mode(0o755)).await?)
}

pub async fn spawn_command(cmd: &mut Command, hint: &str) -> Result<(), anyhow::Error> {
Expand Down

0 comments on commit 50a0917

Please sign in to comment.