Files
lang/src/arch/x86_64/test/full/util.rs
T
2026-06-12 22:24:35 -04:00

14 lines
415 B
Rust

use std::{fs::OpenOptions, io::Write, os::unix::fs::OpenOptionsExt};
pub fn write(path: &str, binary: &[u8]) {
let mut file = OpenOptions::new()
.create(true)
.write(true)
.truncate(true)
.mode(0o750)
.open(path)
.expect("Failed to create file");
file.write_all(binary).expect("Failed to write to file");
file.sync_all().expect("Failed to sync file");
}