fix(dita): report dita's own error output instead of just the exit status - #1141
Open
VXNCXNX wants to merge 1 commit into
Open
fix(dita): report dita's own error output instead of just the exit status#1141VXNCXNX wants to merge 1 commit into
VXNCXNX wants to merge 1 commit into
Conversation
…atus lintDITA captured the dita command's stderr into a buffer and never read it, so a failed conversion showed only 'Runtime error / exit status 1' and every diagnostic was discarded. Return the captured stderr, as lintXML already does, falling back to the exit status when dita fails without writing anything. Fixes vale-cli#578
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
lintDITAwires theditacommand's stderr into a buffer and then never reads it, so a failed conversion shows only the exit status:The actual diagnostic — DTD resolution failures, malformed maps, missing conrefs — is discarded.
This returns the captured stderr, the way
lintXMLalready does atinternal/lint/xml.go:45:Fixes #578
The fallback matters
Copying
lintXMLverbatim (errors.New(eut.String())) would regress the case whereditaexits non-zero without writing anything — the error body would be blank, which is worse than today. So the exit status is kept as a fallback:exit status 1exit status 1exit status 1Verified both failing cases with a stub
ditaon PATH.Worth being precise about the scope:
ditawrites some diagnostics to stdout rather than stderr, and those still will not appear. Onlycmd.Stderris captured here, and I did not want to conflate the two streams into one buffer since that would change what the message looks like in the common case.go test ./internal/...passes. The DITA e2e cases are gated behindrequires: ditaand all cover the success path, which this does not touch.