mirror of
git://git.sv.gnu.org/nano.git
synced 2025-01-09 11:11:59 +03:00
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.
This commit is contained in:
parent
b4dbbe3799
commit
a6dae403e6
@ -2576,7 +2576,7 @@ const char *treat(char *tempfile_name, char *theprogram, bool spelling)
|
|||||||
execvp(arguments[0], arguments);
|
execvp(arguments[0], arguments);
|
||||||
|
|
||||||
/* Terminate the child if the program is not found. */
|
/* Terminate the child if the program is not found. */
|
||||||
exit(1);
|
exit(9);
|
||||||
} else if (thepid < 0)
|
} else if (thepid < 0)
|
||||||
return _("Could not fork");
|
return _("Could not fork");
|
||||||
|
|
||||||
@ -2592,8 +2592,10 @@ const char *treat(char *tempfile_name, char *theprogram, bool spelling)
|
|||||||
doupdate();
|
doupdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!WIFEXITED(program_status) || WEXITSTATUS(program_status) != 0)
|
if (!WIFEXITED(program_status) || WEXITSTATUS(program_status) > 2)
|
||||||
return invocation_error(theprogram);
|
return invocation_error(theprogram);
|
||||||
|
else if (WEXITSTATUS(program_status) != 0)
|
||||||
|
statusline(ALERT, _("The invoked program complained"));
|
||||||
|
|
||||||
/* Stat the temporary file again. */
|
/* Stat the temporary file again. */
|
||||||
stat(tempfile_name, &fileinfo);
|
stat(tempfile_name, &fileinfo);
|
||||||
|
Loading…
Reference in New Issue
Block a user