Skip to content

Commit

Permalink
[MegaLinter] Apply linters fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jan 25, 2024
1 parent 9ec1679 commit 3ed7413
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 35 deletions.
22 changes: 0 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ color-print = "0.3.5"
confique = { version = "0.2.5", default-features = false }
console = "0.15.8"
contracts = "0.6.3"
ctrlc = "3.4.2"
demand = "1.0.1"
dotenvy = "0.15.7"
duct = "0.13.7"
Expand Down
8 changes: 4 additions & 4 deletions src/ui/ctrlc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ use console::Term;
use signal_hook::consts::SIGINT;
use signal_hook::iterator::{Handle, Signals};
use std::process::exit;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::{AtomicBool, Ordering};
use std::thread;

#[derive(Debug)]
pub(crate) struct HandleGuard(Handle);
pub struct HandleGuard(Handle);

/// ensures cursor is displayed on ctrl-c
pub fn handle_ctrlc() -> eyre::Result<Option<HandleGuard>> {
static HANDLED: AtomicBool = AtomicBool::new(false);
let handled = HANDLED.swap(true, std::sync::atomic::Ordering::Relaxed);
let handled = HANDLED.swap(true, Ordering::Relaxed);
if handled {
return Ok(None);
}
Expand All @@ -24,7 +24,7 @@ pub fn handle_ctrlc() -> eyre::Result<Option<HandleGuard>> {
debug!("Ctrl-C pressed, exiting...");
exit(1);
}
HANDLED.store(false, std::sync::atomic::Ordering::Relaxed);
HANDLED.store(false, Ordering::Relaxed);
});
Ok(Some(handle))
}
Expand Down
16 changes: 8 additions & 8 deletions test/fixtures/signal-test.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
let i = 3;
let i = 3

process.on('SIGINT', function() {
process.on('SIGINT', function () {
if (i > 0) {
console.log(`Got SIGINT. Press Control-D to exit. ${i} times left`);
i--;
console.log(`Got SIGINT. Press Control-D to exit. ${i} times left`)
i--
} else {
process.exit();
process.exit()
}
});
})

// wait for 60 seconds
setTimeout(function() {}, 60000);
console.log('Running. Press Control-C to test.');
setTimeout(function () {}, 60000)
console.log('Running. Press Control-C to test.')

0 comments on commit 3ed7413

Please sign in to comment.