summaryrefslogtreecommitdiffstats
path: root/Cargo.toml
diff options
context:
space:
mode:
authorRory Dudley2024-02-24 21:24:19 -0700
committerRory Dudley2024-02-24 21:24:19 -0700
commitb6fc81066cfcc29d4519191eae5ba19581ad2774 (patch)
treeb11eb5bd076e672812f94ba8578e80769c02f86f /Cargo.toml
parent536e250653e5c140a6d9e60f1cd652b79135e7a6 (diff)
downloaddwarvish-b6fc81066cfcc29d4519191eae5ba19581ad2774.tar.gz
Replace ctrlc with signal-hooksignal
Replaced the 'ctrlc' crate with 'signal-hook' for handling of SIGINT. The 'signal_hook::low_level::register' function is actually unsafe. However, according to https://docs.rs/signal-hook/latest/signal_hook/low_level/fn.register.html, it is only unsafe in the case of multithreaded applications. There are some race conditions as well. For instance, it appears that even when we fork to a child process, SIGINT is captured on both that process, as well as the shell.
Notes
Notes: The replacement was motivated by the fact that 'ctrlc' appears to use a separate thread to handle interrupts. This is evident if you run: ps aux | grep dwvsh USER PID %CPU %MEM VSZ RSS TTY STAT START COMMAND user pid 0.0 0.0 71500 3072 term Sl+ 20:08 target/debug/dwvsh Further reading in 'man ps' under 'PROCESS STATE CODES', reveals that 'l' is a process state referring to multithreaded applications. Given the nature of interupts, this seems unnecessary. The issue where SIGINT is captured by both the shell, and child process will have to be addressed.
Diffstat (limited to 'Cargo.toml')
-rw-r--r--Cargo.toml4
1 files changed, 1 insertions, 3 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 00fdb24..ae18cfc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,7 +9,5 @@ description = "A POSIX compliance shell and tiny functional programming language
name = "dwvsh"
path = "src/main.rs"
-# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
-
[dependencies]
-ctrlc = "3.4.2"
+signal-hook = "0.3.17"