On Wed, Aug 07, 2013 at 12:52:48PM +0400, Pavel Fedin wrote: >> I tried to explain that in my first response: 'fork' has a certain >> semantics and implements requirements that 'spawn' does not. > >Stop stop stop... Just to avoid misunderstanding here... fork() alone >cannot be replaced with spawn(), yes. But as fas as i understand, make >does not use fork() alone. It uses fork() + exec() pair in order to >start external programs. As an end result, it is expected to run an >external executable with some defined environment (make sets >environment in the child then uses execvp() where external binary >inherits it ). spawnvpe() does absolutely the same, but in one shot. >It runs an external executable with predefined environment. Similar to >fork(), spawnvpe() returns child's PID, which allows to wait for its >termination, send signals, etc. And of course the started binary runs >completely asynchronously, the same as with fork() + exec().
Eli certainly understand all of this. > Windows actually does not allow to fork() cleanly by design (there's a full >explanation in http://www.cygwin.com/cygwin-ug-net/highlights.html ). >spawn() is much faster because the child is created from scratch with a new >executable, it does not have to be a clone of the parent, so it perfectly >wraps to legitimate CreateProcess() call. > $(shell ) function also works fine, consequently we really perfectly handle >stdin/stdout (without this i don't see how command output would be >captured). > So... And he understand this too. The point, which you seem to be missing, is that since Cygwin strives to provide a UNIX-like environment, we spend a lot of time making sure that fork works like it does on UNIX. You won't find spawn() (posix_spawn exists but it is a different beast) on UNIX. So there is no guarantees that using spawn() in make will exactly mimic UNIX functionality. Also, when I'm making changes to the exec() code I don't spend a lot of time worrying about spawn() so it is possible that it will be broken from time to time and, in fact, I think you actually noticed some breakage in the cygwin list. make already has a mechanism for passing command line switches down. I think you'd have to work to defeat it. So, for correctness, I would also would rather have an option which requires the user to specify this on the command line. cgf _______________________________________________ Bug-make mailing list Bug-make@gnu.org https://lists.gnu.org/mailman/listinfo/bug-make