From 60870694936e06b1718b1af1660c2af592d9c49d Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Wed, 22 Nov 2023 22:34:10 +0530 Subject: [PATCH] fix(windows): write file differently for windows --- src/cli/build.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/cli/build.rs b/src/cli/build.rs index 6bf9871..b158c69 100644 --- a/src/cli/build.rs +++ b/src/cli/build.rs @@ -44,14 +44,18 @@ pub async fn build_standalone + Into>( patched_bin.append(&mut signature.clone()); // Write the compiled binary to file - OpenOptions::new() - .write(true) - .create(true) - .mode(0o770) - .open(output_path) - .await? - .write_all(&patched_bin) - .await?; + if cfg!(unix) { + OpenOptions::new() + .write(true) + .create(true) + .mode(0o770) + .open(output_path) + .await? + .write_all(&patched_bin) + .await?; + } else if cfg!(windows) { + fs::write(output_path, &patched_bin).await?; + } Ok(ExitCode::SUCCESS) }