On Wed, Mar 02, 2005 at 02:44:34AM -0500, Jeff Allen wrote: >Ctrl-C cannot kill my program after it calls system(). It's happening >in a bigger program that uses UDP, etc. But I can reproduce it in the >tiny program below. > >The following test program shows the problem. You can kill it with >ctrl-c during the first sleep, but you cannot kill it during the >second sleep. It will exit correctly after 5 seconds. > >#include <stdio.h> >int main() >{ > printf("sleeping for 5 secs...\n"); > sleep(5); > system("echo the hostname is: `hostname`"); > printf("sleeping for 5 secs...\n"); > sleep(5); >} > >I noticed lots of discussion about signals in the archives, but >nothing related to signals and system().
There actually was some discussion about signals and system because I fixed a problem with them back in (I think) 2003. I didn't go far enough in my fix, however. A better solution should be in today's snapshot: http://cygwin.com/snapshots/ which is uploading right now. cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/