~ chicken-core (chicken-5) b60f0ae50a1175ab054be92a4e19cc6bbe1a5de2


commit b60f0ae50a1175ab054be92a4e19cc6bbe1a5de2
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Thu Jan 5 09:34:06 2012 +0100
Commit:     zbigniew <zbigniewsz@gmail.com>
CommitDate: Mon Jan 16 11:04:54 2012 -0600

    Added win32-specific keyboard-interrupt handling in read/peek char routines in C runtime system
    
    According to information found here:
    
      http://mail.python.org/pipermail/python-bugs-list/2002-July/012579.html
    
    Without this patch SIGINT will result in the input routine returning EOF
    which makes csi exit.
    
    Signed-off-by: Jim Ursetto <zbigniewsz@gmail.com>

diff --git a/runtime.c b/runtime.c
index 58f61643..41a2f9d9 100644
--- a/runtime.c
+++ b/runtime.c
@@ -3957,6 +3957,11 @@ C_regparm C_word C_fcall C_read_char(C_word port)
 
   if(c == EOF) {
     if(errno == EINTR) return C_fix(-1);
+    /* Found here:
+       http://mail.python.org/pipermail/python-bugs-list/2002-July/012579.html */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+    else if(GetLastError() == ERROR_OPERATION_ABORTED) return C_fix(-1);
+#endif
     else return C_SCHEME_END_OF_FILE;
   }
 
@@ -3971,6 +3976,10 @@ C_regparm C_word C_fcall C_peek_char(C_word port)
 
   if(c == EOF) {
     if(errno == EINTR) return C_fix(-1);
+    /* see above */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+    else if(GetLastError() == ERROR_OPERATION_ABORTED) return C_fix(-1);
+#endif
     else return C_SCHEME_END_OF_FILE;
   }
 
Trap