From 356bfacef7da39052d404e2db166996cf7b74d4d Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Sat, 20 Apr 2024 16:08:09 +0100 Subject: make: skip shell -e option when running commands POSIX says, regarding execution of commands: The execution line shall then be executed by a shell as if it were passed as the argument to the system() interface, except that if errors are not being ignored then the shell -e option shall also be in effect. As a non-POSIX extension, skip the use of the -e option. This is how GNU make and BSD make behave. (GitHub issue #409) --- miscutils/make.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'miscutils') diff --git a/miscutils/make.c b/miscutils/make.c index 87f17aad7..970919ddc 100644 --- a/miscutils/make.c +++ b/miscutils/make.c @@ -2217,7 +2217,7 @@ docmds(struct name *np, struct cmd *cp) if (sdomake) { // Get the shell to execute it int status; - char *cmd = !signore ? auto_concat("set -e;", q) : q; + char *cmd = !signore && posix ? auto_concat("set -e;", q) : q; target = np; status = system(cmd); @@ -2233,7 +2233,6 @@ docmds(struct name *np, struct cmd *cp) diagnostic("failed to build '%s'", np->n_name); estat |= MAKE_FAILURE; free(command); - free(cmd); break; } else if (doinclude) { warning("failed to build '%s'", np->n_name); -- cgit v1.2.3-55-g6feb