summaryrefslogtreecommitdiff
path: root/function.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2013-09-21 15:23:05 -0400
committerPaul Smith <psmith@gnu.org>2013-09-21 17:08:42 -0400
commit9cd01958da86a68d0e47defcb9745ab373ef3d79 (patch)
treec43410ce8ab951afa22d6a17f68c5c84ea656025 /function.c
parent4120f91846f781ead7350f86c9614a19824450f5 (diff)
downloadgunmake-9cd01958da86a68d0e47defcb9745ab373ef3d79.tar.gz
Ensure that stderr from shell functions in recipes is synced.
Diffstat (limited to 'function.c')
-rw-r--r--function.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/function.c b/function.c
index 4ea2446..866ac48 100644
--- a/function.c
+++ b/function.c
@@ -1710,7 +1710,7 @@ func_shell_base (char *o, char **argv, int trim_newlines)
CLOSE_ON_EXEC(pipedes[1]);
CLOSE_ON_EXEC(pipedes[0]);
/* Never use fork()/exec() here! Use spawn() instead in exec_command() */
- pid = child_execute_job (0, pipedes[1], command_argv, envp);
+ pid = child_execute_job (FD_STDIN, pipedes[1], FD_STDOUT, command_argv, envp);
if (pid < 0)
perror_with_name (error_prefix, "spawn");
# else /* ! __EMX__ */
@@ -1719,12 +1719,14 @@ func_shell_base (char *o, char **argv, int trim_newlines)
perror_with_name (error_prefix, "fork");
else if (pid == 0)
{
-#ifdef SET_STACK_SIZE
+# ifdef SET_STACK_SIZE
/* Reset limits, if necessary. */
if (stack_limit.rlim_cur)
setrlimit (RLIMIT_STACK, &stack_limit);
-#endif
- child_execute_job (0, pipedes[1], command_argv, envp);
+# endif
+ child_execute_job (FD_STDIN, pipedes[1],
+ output_context ? output_context->err : FD_STDERR,
+ command_argv, envp);
}
else
# endif