Skip to content

Commit

Permalink
fix: cfg macro config
Browse files Browse the repository at this point in the history
  • Loading branch information
filipslezaklab committed Sep 21, 2023
1 parent f50406f commit 33a073c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/gpg.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[cfg(target_family = "unix")]
use std::path::PathBuf;
use std::time::Duration;
use std::{
Expand Down Expand Up @@ -62,7 +63,7 @@ save"#,
)
}

#[cfg(unix)]
#[cfg(target_family = "unix")]
pub fn set_permissions(dir_path: &PathBuf) -> Result<(), WorkerError> {
use std::os::unix::prelude::PermissionsExt;

Expand All @@ -74,9 +75,10 @@ pub fn set_permissions(dir_path: &PathBuf) -> Result<(), WorkerError> {
pub fn init_gpg() -> Result<(String, Child), WorkerError> {
let mut temp_path = env::temp_dir();
temp_path.push("yubikey-provision");
if cfg!(unix) {
set_permissions(&temp_path)?;
}

#[cfg(target_family = "unix")]
set_permissions(&temp_path)?;

let temp_path_str = temp_path.to_str().ok_or(WorkerError::Gpg)?;

{
Expand Down

0 comments on commit 33a073c

Please sign in to comment.