Re: Output disappears when using interrupt key

Guido.van.Rossum@cwi.nl
Thu, 15 Apr 1993 11:16:47 +0200

In response to Steven's problem of ^C requiring a newline, some people
suggested that BSD has a way to turn off system call restarting. The
following fix works on our version of SunOS (4.1.1); please try it if
you have this problem and see if it compiles and works. (The symbol
SV_INTERRUPT is defined in <sys/signal.h> or <signal.h>.)

-------------------------------------------------------------------------------
diff -c -r2.8 intrcheck.c
*** 2.8 1993/03/29 10:41:47
--- intrcheck.c 1993/04/15 08:58:58
***************
*** 140,145 ****
--- 140,154 ----
{
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
signal(SIGINT, intcatcher);
+ #ifdef SV_INTERRUPT
+ /* This is for SunOS and other modern BSD derivatives.
+ It means that system calls (like read()) are not restarted
+ after an interrupt. This is necessary so interrupting a
+ read() or readline() call works as expected.
+ XXX On old BSD (pure 4.2 or older) you may have to do this
+ differently! */
+ siginterrupt(SIGINT, 1);
+ #endif
}

int
-------------------------------------------------------------------------------

Thankyou Jan-Hein Buhrman and Sjoerd Mullender,

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>