summaryrefslogtreecommitdiff
path: root/function.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2010-08-07 08:46:06 +0000
committerEli Zaretskii <eliz@gnu.org>2010-08-07 08:46:06 +0000
commitb6b687598667e9376f100b805391d435af6f5a0d (patch)
tree486d3ab262615f2428307ca52dc49d209ae12f1f /function.c
parent8f029808af8985e63c07b10caaff78c93b795ed0 (diff)
downloadgunmake-b6b687598667e9376f100b805391d435af6f5a0d.tar.gz
function.c (func_shell) [WINDOWS32]: Reset just_print_flag
around the call to construct_command_argv, so that a temporary batch file _is_ created when needed for $(shell). Fixes Savannah bug #16362.
Diffstat (limited to 'function.c')
-rw-r--r--function.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/function.c b/function.c
index e2f6c8c..2bc61fe 100644
--- a/function.c
+++ b/function.c
@@ -1597,11 +1597,24 @@ func_shell (char *o, char **argv, const char *funcname UNUSED)
pid_t pid;
#ifndef __MSDOS__
+#ifdef WINDOWS32
+ /* Reset just_print_flag. This is needed on Windows when batch files
+ are used to run the commands, because we normally refrain from
+ creating batch files under -n. */
+ int j_p_f = just_print_flag;
+
+ just_print_flag = 0;
+#endif
/* Construct the argument list. */
command_argv = construct_command_argv (argv[0], NULL, NULL, 0,
&batch_filename);
if (command_argv == 0)
- return o;
+ {
+#ifdef WINDOWS32
+ just_print_flag = j_p_f;
+#endif
+ return o;
+ }
#endif
/* Using a target environment for `shell' loses in cases like:
@@ -1637,11 +1650,13 @@ func_shell (char *o, char **argv, const char *funcname UNUSED)
}
#elif defined(WINDOWS32)
windows32_openpipe (pipedes, &pid, command_argv, envp);
+ /* Restore the value of just_print_flag. */
+ just_print_flag = j_p_f;
+
if (pipedes[0] < 0)
{
- /* open of the pipe failed, mark as failed execution */
+ /* Open of the pipe failed, mark as failed execution. */
shell_function_completed = -1;
-
return o;
}
else