Mercurial > octave
changeset 27899:fde18e0a2984
Have TexInfo errors result in warning delivered to user (patch #9464)
Previously, we called "makeinfo --force" so that we returned at least
partial output even from malformed TeXinfo. However, this meant it was
not possible to determine that an error had occurred because "status"
was not set. Instead we call makeinfo once, and only if there was an
error, we process a second time with --force.
* __makeinfo__.m: Call makeinfo first without "--force" option.
Check output status and re-invoke WITH "--force" if necessary.
author | Colin Macdonald <cbm@m.fsf.org> |
---|---|
date | Thu, 07 Mar 2019 10:20:11 -0800 |
parents | 4d6d21839dfd |
children | bfa80cf7c1db |
files | scripts/help/__makeinfo__.m |
diffstat | 1 files changed, 12 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/help/__makeinfo__.m Thu Jan 02 15:43:01 2020 -0500 +++ b/scripts/help/__makeinfo__.m Thu Mar 07 10:20:11 2019 -0800 @@ -135,10 +135,10 @@ ## Take action depending on output type switch (lower (output_type)) case "plain text" - cmd = sprintf ('%s --no-headers --no-warn --force --no-validate --plaintext --output=- "%s"', + cmd = sprintf ('%s --no-headers --no-warn --no-validate --plaintext --output=- "%s"', makeinfo_program (), name); case "html" - cmd = sprintf ('%s --no-headers --html --no-warn --no-validate --force --output=- "%s"', + cmd = sprintf ('%s --no-headers --html --no-warn --no-validate --output=- "%s"', makeinfo_program (), name); otherwise error ("__makeinfo__: unsupported output type: '%s'", output_type); @@ -147,6 +147,16 @@ ## Call makeinfo [status, retval] = system (cmd); + ## On error, retry with force to ensure user gets *something* + if (status) + cmd = regexprep (cmd, '--output=', '--force --output=', 'once'); + [status_force, retval] = system (cmd); + ## original return value usually more useful + if (status_force) + status = status_force; + end + end + ## Clean up extra newlines generated by makeinfo if (strcmpi (output_type, "plain text")) if (numel (retval) > 2 && retval(end-1:end) == "\n\n")