Skip to content

Commit

Permalink
Prevent creation of more than one error file
Browse files Browse the repository at this point in the history
  • Loading branch information
Systemcluster committed Jul 23, 2024
1 parent bf0c942 commit 85125a2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions startpe/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::{
mem::size_of,
panic::set_hook,
process::Command,
sync::atomic::{AtomicBool, Ordering},

Check warning on line 8 in startpe/src/main.rs

View workflow job for this annotation

GitHub Actions / Checks (ubuntu-latest, 1.77.2)

unused imports: `AtomicBool`, `Ordering`

Check warning on line 8 in startpe/src/main.rs

View workflow job for this annotation

GitHub Actions / Checks (ubuntu-latest, 1.77.2)

unused imports: `AtomicBool`, `Ordering`

Check warning on line 8 in startpe/src/main.rs

View workflow job for this annotation

GitHub Actions / Checks (macos-latest, 1.77.2)

unused imports: `AtomicBool`, `Ordering`

Check warning on line 8 in startpe/src/main.rs

View workflow job for this annotation

GitHub Actions / Checks (macos-latest, 1.77.2)

unused imports: `AtomicBool`, `Ordering`
time::SystemTime,
};

Expand Down Expand Up @@ -53,6 +54,10 @@ fn main() {
}
#[cfg(windows)]
{
static WRITTEN: AtomicBool = AtomicBool::new(false);
if WRITTEN.swap(true, Ordering::Relaxed) {
return;
}
let now = SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
.unwrap_or_default();
Expand Down

0 comments on commit 85125a2

Please sign in to comment.