formatter: accept the formatted result also upon a nonzero exit status

For a nonzero exit status of the formatting program, report on the
status bar that the program "complained", but read in the (probably)
reformatted text anyway -- it can be easily undone with M-U.  Only
report failure when the intended program could not be run.

This fixes https://savannah.gnu.org/bugs/?57105.
master
Benno Schulenberg 2019-10-25 17:29:56 +02:00
parent b4dbbe3799
commit a6dae403e6
1 changed files with 4 additions and 2 deletions

View File

@ -2576,7 +2576,7 @@ const char *treat(char *tempfile_name, char *theprogram, bool spelling)
execvp(arguments[0], arguments);
/* Terminate the child if the program is not found. */
exit(1);
exit(9);
} else if (thepid < 0)
return _("Could not fork");
@ -2592,8 +2592,10 @@ const char *treat(char *tempfile_name, char *theprogram, bool spelling)
doupdate();
}
if (!WIFEXITED(program_status) || WEXITSTATUS(program_status) != 0)
if (!WIFEXITED(program_status) || WEXITSTATUS(program_status) > 2)
return invocation_error(theprogram);
else if (WEXITSTATUS(program_status) != 0)
statusline(ALERT, _("The invoked program complained"));
/* Stat the temporary file again. */
stat(tempfile_name, &fileinfo);