Skip to content

Commit

Permalink
Set Ctrl-C signal handler
Browse files Browse the repository at this point in the history
  • Loading branch information
certik committed Sep 13, 2024
1 parent 8c1fa87 commit 108c614
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/shell/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ rustyline = { version = "14.0.0", features = ["derive"] }
tokio = "1.40.0"
uu_ls = "0.0.27"
dirs = "5.0.1"
ctrlc = "3.4.5"

[package.metadata.release]
# Dont publish the binary
Expand Down
5 changes: 5 additions & 0 deletions crates/shell/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ async fn interactive() -> anyhow::Result<()> {
.completion_type(CompletionType::Circular)
.build();

ctrlc::set_handler(move || {
println!("Received Ctrl+C");
})
.expect("Error setting Ctrl-C handler");

let mut rl = Editor::with_config(config)?;

let helper = helper::ShellPromptHelper::default();
Expand Down

0 comments on commit 108c614

Please sign in to comment.