We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ecfca91 commit c9464f2Copy full SHA for c9464f2
src/main.rs
@@ -17,6 +17,10 @@ pub extern "C" fn sigchld_handler(_signum: i32) {
17
*jobs = true;
18
}
19
20
+pub extern "C" fn sigint_handler(_signum: i32) {
21
+ // Handle SIGINT (Ctrl+C) do nothing
22
+}
23
+
24
fn repl() {
25
let stdin = io::stdin();
26
let mut stdout = io::stdout();
@@ -34,6 +38,12 @@ fn repl() {
34
38
signal::SigHandler::Handler(sigchld_handler),
35
39
)
36
40
.expect("Error setting signal handler");
41
42
+ signal::signal(
43
+ signal::Signal::SIGINT,
44
+ signal::SigHandler::Handler(sigint_handler),
45
+ )
46
+ .expect("Error setting signal handler for SIGINT");
37
47
48
if let Some(arg) = env::args().nth(1) {
49
let code_str = std::fs::read_to_string(arg).expect("Error reading file");
0 commit comments