Skip to content

Commit 85125a2

Browse files
committed
Prevent creation of more than one error file
1 parent bf0c942 commit 85125a2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

startpe/src/main.rs

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::{
55
mem::size_of,
66
panic::set_hook,
77
process::Command,
8+
sync::atomic::{AtomicBool, Ordering},
89
time::SystemTime,
910
};
1011

@@ -53,6 +54,10 @@ fn main() {
5354
}
5455
#[cfg(windows)]
5556
{
57+
static WRITTEN: AtomicBool = AtomicBool::new(false);
58+
if WRITTEN.swap(true, Ordering::Relaxed) {
59+
return;
60+
}
5661
let now = SystemTime::now()
5762
.duration_since(SystemTime::UNIX_EPOCH)
5863
.unwrap_or_default();

0 commit comments

Comments
 (0)