Skip to content

Commit b649dac

Browse files
chore: remove the cursor hiding
The benefits of this are really not worth the hassle of making sure the cursor gets re-enabled. For this, we'll want some actual TUI frontend that is solved these issues for us.
1 parent 8c6070f commit b649dac

1 file changed

Lines changed: 1 addition & 42 deletions

File tree

src/cli/mod.rs

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,14 @@ use crate::{
1818
api_client::CodSpeedAPIClient,
1919
config::CodSpeedConfig,
2020
executor::helpers::command::CommandBuilder,
21-
local_logger::{CODSPEED_U8_COLOR_CODE, IS_TTY, init_local_logger},
21+
local_logger::{CODSPEED_U8_COLOR_CODE, init_local_logger},
2222
prelude::*,
2323
project_config::DiscoveredProjectConfig,
2424
};
2525
use clap::{
2626
Parser, Subcommand,
2727
builder::{Styles, styling},
2828
};
29-
use console::Term;
30-
31-
/// Guard that hides the terminal cursor on creation and restores it on drop.
32-
struct CursorGuard;
33-
34-
impl CursorGuard {
35-
fn new() -> Self {
36-
if *IS_TTY {
37-
let _ = Term::stderr().hide_cursor();
38-
}
39-
Self
40-
}
41-
}
42-
43-
impl Drop for CursorGuard {
44-
fn drop(&mut self) {
45-
if *IS_TTY {
46-
let _ = Term::stderr().show_cursor();
47-
}
48-
}
49-
}
5029

5130
fn create_styles() -> Styles {
5231
styling::Styles::styled()
@@ -151,26 +130,6 @@ impl InternalCommands {
151130

152131
pub async fn run() -> Result<()> {
153132
let cli = Cli::parse();
154-
// Important: keep this after the Cli::parse() because the function can exit the process by itself, skipping the drop of the CursorGuard
155-
let _cursor_guard = CursorGuard::new();
156-
if *IS_TTY {
157-
// Ctrl+C terminates the process before `CursorGuard::drop` runs,
158-
// so we restore the cursor explicitly, then re-raise SIGINT with
159-
// the default disposition so the parent shell sees the expected
160-
// signal-terminated status.
161-
tokio::spawn(async {
162-
if tokio::signal::ctrl_c().await.is_ok() {
163-
drop(_cursor_guard); // explicitly drop to restore cursor before re-raising
164-
}
165-
// Safety: resetting SIGINT to SIG_DFL and raising it are
166-
// async-signal-safe and have no Rust-level invariants to break.
167-
unsafe {
168-
libc::signal(libc::SIGINT, libc::SIG_DFL);
169-
libc::raise(libc::SIGINT);
170-
}
171-
});
172-
}
173-
174133
let mut api_client = build_api_client(&cli)?;
175134

176135
// Discover project configuration file

0 commit comments

Comments
 (0)