Skip to content

Commit fc9e531

Browse files
authored
Merge pull request RustPython#4414 from moreal/keyboard-int-exitcode
Correct exitcode of KeyboardInterrupt
2 parents 7659331 + 16579ae commit fc9e531

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

vm/src/vm/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,19 @@ impl VirtualMachine {
757757
writeln!(stderr, "{msg}");
758758
}
759759
1
760+
} else if exc.fast_isinstance(self.ctx.exceptions.keyboard_interrupt) {
761+
#[allow(clippy::if_same_then_else)]
762+
{
763+
self.print_exception(exc);
764+
#[cfg(unix)]
765+
{
766+
(libc::SIGINT as u8) + 128u8
767+
}
768+
#[cfg(not(unix))]
769+
{
770+
1
771+
}
772+
}
760773
} else {
761774
self.print_exception(exc);
762775
1

0 commit comments

Comments
 (0)