Skip to content

Commit 5347de9

Browse files
committed
Prevent creation of more than one error file
1 parent de0f23b commit 5347de9

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
@@ -53,6 +53,11 @@ fn main() {
5353
}
5454
#[cfg(windows)]
5555
{
56+
use std::sync::atomic::{AtomicBool, Ordering};
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)