[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to get make to terminate itself at the first error?

From: Paul Smith
Subject: Re: how to get make to terminate itself at the first error?
Date: Tue, 03 Feb 2009 00:45:07 -0500

On Mon, 2009-02-02 at 19:05 -0500, Martin d Anjou wrote:
> > Well, I guess you could change the code to send a SIGINT to the process
> > group, the same way using ^C at the command line would.
> Ok, so here is a variation on my previous attempt. This time, I use 
> // job.c inside reap_children() near line 500:
> if (err && block)
>    {
>      static int printed = 0;
>      fflush (stdout);
>      if (!printed)
>      {
>        error (NILF, _("*** Waiting for unfinished jobs...."));
>        fatal_error_signal(SIGINT);
>      }
>      printed = 1;
>    }
> I am not getting what I want from this code. The prompt does come back, 
> but child processes do not completely go away. So this is not the same as 
> ^C. Perhaps I am not doing this in the correct place in the code.

OK, I took a look at the code (I probably should have done that in the
first place!)

Note I said above you have to send SIGINT to the process _group_.
That's not what fatal_error_signal(SIGINT) does, so that's why you're
not getting the children killed.  fatal_error_signal() is intended to be
installed as a signal handler, not invoked directly, so when it gets
SIGINT it assumes that the signal already went to the process group.

However, looking more closely at fatal_error_signal() it appears that if
you send it SIGTERM it WILL try to kill every existing child process by
sending it a SIGTERM.  That should cause those to die.  So offhand it
seems to me that your original attempt (sending SIGTERM) should have
worked.  Offhand I can't see any reason it wouldn't, unless the child
had handled SIGTERM for some reason.

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

[Prev in Thread] Current Thread [Next in Thread]