Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avm: Use #[cfg(unix)] when running UNIX-only functionality #3464

Conversation

acheroncrypto
Copy link
Collaborator

Problem

After downloading the binary for the specific target, we change file permissions in UNIX to make the file executable:

anchor/avm/src/lib.rs

Lines 275 to 280 in 08110e9

// Set file to executable on UNIX
#[cfg(not(target_os = "windows"))]
fs::set_permissions(
bin_path,
<fs::Permissions as std::os::unix::fs::PermissionsExt>::from_mode(0o775),
)?;

While this technically works (because all non-Windows OS' we release binaries for are UNIX), it would still be better to use #[cfg(unix)] to make the intention clearer.

Summary of changes

Use #[cfg(unix)] when running UNIX-only functionality instead of #[cfg(not(target_os = "windows"))].

Copy link

vercel bot commented Jan 2, 2025

@acheroncrypto is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

@acheroncrypto acheroncrypto added avm fix Bug fix PR labels Jan 2, 2025
@acheroncrypto acheroncrypto merged commit 8eec2e3 into coral-xyz:master Jan 2, 2025
52 of 53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
avm fix Bug fix PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant