}
shell_function_pid = 0;
- /* shell_completed() will set shell_function_completed to 1 when the
- child dies normally, or to -1 if it dies with status 127, which is
- most likely an exec fail. */
-
- if (shell_function_completed == -1)
- {
- /* This likely means that the execvp failed, so we should just
- write the error message in the pipe from the child. */
- fputs (buffer, stderr);
- fflush (stderr);
- }
- else
- {
- /* The child finished normally. Replace all newlines in its output
- with spaces, and put that in the variable output buffer. */
- fold_newlines (buffer, &i, trim_newlines);
- o = variable_buffer_output (o, buffer, i);
- }
+ /* Replace all newlines in the command's output with spaces, and put that
+ in the variable output buffer. */
+ fold_newlines (buffer, &i, trim_newlines);
+ o = variable_buffer_output (o, buffer, i);
free (buffer);
}
$ERR_unreadable_file = undef;
$ERR_nonexe_file = undef;
$ERR_exe_dir = undef;
+$ERR_command_not_found = undef;
{
use locale;
unlink('file.out') or die "Failed to delete file.out: $!\n";
+ $_ = `/bin/sh -c 'bad-command 2>&1'`;
+ if ($? == 0) {
+ print "Invoked invalid file! Skipping related tests.\n";
+ } else {
+ chomp($_);
+ s/bad-command/#CMDNAME#/g;
+ $ERR_command_not_found = $_;
+ }
+
$loc and POSIX::setlocale(&POSIX::LC_ALL, $loc);
}
# This needs to be ported to Windows, or else Windows error messages
# need to converted to look like more normal make errors.
run_make_test('
+.RECIPEPREFIX = >
all:
- @echo hi
- $(shell ./basdfdfsed there)
- @echo $(.SHELLSTATUS)
+>@echo hi
+>$(shell ./basdfdfsed there)
+>@echo $(.SHELLSTATUS)
',
'', "#MAKE#: ./basdfdfsed: $ERR_no_such_file\nhi\n127\n");
STAT := $(.SHELLSTATUS)
all: ; @echo STAT=$(STAT)
','',"STAT=$ret\n");
+
+ # Test that not-found errors can be redirected
+ if ($ERR_command_not_found) {
+ $_ = $ERR_command_not_found;
+ s/#CMDNAME#/bad-command/g;
+ run_make_test(q!
+out := $(shell bad-command 2>&1)
+all: ; @echo '$(.SHELLSTATUS): $(out)'
+!,
+ '', "127: $_\n");
+ }
}
1;
-
-### Local Variables:
-### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
-### End: