nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit a6dae403e6fda358b68b0c91d7232ae9cc11cc4b
parent b4dbbe379952d797b5d1dde42fec20c3874037ff
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Fri, 25 Oct 2019 17:29:56 +0200

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.

Diffstat:
Msrc/text.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/text.c b/src/text.c @@ -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);