The reason SIGTERM behaves differently than SIGINT (for example) is obvious: if you look at the fatal_error_signal() code you'll see that if the signal is SIGTERM extra operations are run: in particular, it goes through each of the child processes and sends a SIGTERM to each PID. For SIGINT, no such loop is performed.
The difference you're seeing in behavior is because of make's fast path vs. slow path. If make determines that the command to be invoked is "simple enough", make will simply fork/exec that command directly. If the command is not "simple enough", then make will fork a shell (/bin/sh) and pass the command to the shell to run. This has a big performance benefit. The "simple enough" determination is made by looking for various special characters in the command string. In the version that works as you want, the command "sleep 30" is simple enough, so make just forks/execs the /usr/bin/sleep command directly with an argument of 30. When make sends that process a SIGTERM, it dies (which is what you expect). In the version that behaves differently the command to be run is complex, containing shell operators like "&&" and "||", so make must run a shell. In this situation, the shell is the child PID that receives the SIGTERM. Apparently in this case the shell dies but doesn't kill any of its children. It may be more correct for make to send the SIGTERM to the child's process group, rather than just to the PID itself. However, I think that this could cause problems because all of the sub-processes are actually in the same process group (normally). It's something that would need to be considered carefully, for sure. -- ------------------------------------------------------------------------------- Paul D. Smith <[email protected]> Find some GNU make tips at: http://www.gnu.org http://make.mad-scientist.us "Please remain calm...I may be mad, but I am a professional." --Mad Scientist _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
