From 16579aeafec8d622f380360e7969d2487af8ef93 Mon Sep 17 00:00:00 2001 From: Moreal Date: Tue, 3 Jan 2023 20:33:50 +0900 Subject: [PATCH] Correct exitcode of KeyboardInterrupt --- vm/src/vm/mod.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/vm/src/vm/mod.rs b/vm/src/vm/mod.rs index 4432255243..17d4c91a2a 100644 --- a/vm/src/vm/mod.rs +++ b/vm/src/vm/mod.rs @@ -757,6 +757,19 @@ impl VirtualMachine { writeln!(stderr, "{msg}"); } 1 + } else if exc.fast_isinstance(self.ctx.exceptions.keyboard_interrupt) { + #[allow(clippy::if_same_then_else)] + { + self.print_exception(exc); + #[cfg(unix)] + { + (libc::SIGINT as u8) + 128u8 + } + #[cfg(not(unix))] + { + 1 + } + } } else { self.print_exception(exc); 1