Skip to content

Commit

Permalink
Fix windows build of cli tool
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Dec 26, 2022
1 parent e59c40a commit 8b49344
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/bin/lnpbp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ extern crate serde_crate as serde;

use std::fmt::{Debug, Display, Formatter};
use std::io::{self, Read, Write};
use std::os::unix::fs::PermissionsExt;
use std::path::PathBuf;
use std::str::FromStr;
use std::string::FromUtf8Error;
Expand Down Expand Up @@ -386,12 +385,17 @@ fn main() -> Result<(), Error> {

match opts.command {
Command::Identity(IdentityCommand::Create { algo, file }) => {
#[cfg(not(target_os = "windows"))]
use std::os::unix::fs::PermissionsExt;

if algo != EcAlgo::Bip340 {
todo!("other than Secp256k1 BIP340 algorithms")
}
let id = IdentitySigner::new_bip340();
let fd = fs::File::create(file)?;
#[allow(unused_mut)]
let mut perms = fd.metadata()?.permissions();
#[cfg(not(target_os = "windows"))]
perms.set_mode(0o600);
fd.set_permissions(perms)?;
id.strict_encode(fd)?;
Expand Down

0 comments on commit 8b49344

Please sign in to comment.