Open markmandel opened 2 years ago
Mdbook will return an error if the preprocessor fails when doing the preprocess step. However, it doesn't fail during the "supports" step. Unfortunately the preprocessor API can't distinguish between "the preprocessor supports a given renderer" and "the preprocessor crashed". It only knows that a non-zero exit code means the renderer isn't supported.
I think ideally a more sophisticated interface would help here (such as requiring the preprocessor to return some structured message on stdout to positively indicate that it supports the renderer).
I think ideally a more sophisticated interface would help here (such as requiring the preprocessor to return some structured message on stdout to positively indicate that it supports the renderer).
That would work too!
Adding to the context, if the preprocessor is not found, in that case too mdbook returns non-zero exit code.
$ mdbook build
2023-07-11 23:42:51 [INFO] (mdbook::book): Book building has started
2023-07-11 23:42:51 [WARN] (mdbook::preprocess::cmd): The command wasn't found, is the "hide" preprocessor installed?
2023-07-11 23:42:51 [WARN] (mdbook::preprocess::cmd): Command: mdbook-hide
Warning: The mdbook-toc preprocessor was built against version 0.4.27 of mdbook, but we're being called from version 0.4.31
2023-07-11 23:42:51 [INFO] (mdbook::book): Running the html backend
Context:
I have
mdbook build
running through my CI system so that we can test if the documentation builds, and links exist, etc.I recently realised that the documentation was failing to build, because the preprocessor was failing, but since it didn't affect the subsequent tests it was passing and went unnoticed for a while.
Logs:
As you can see above, my
preprocessor.sh
(which is the preprocessor) fails when executing directly, and if run on it's own returns a status of 101.But when run through mdbook, it exits with a 0 as if nothing failed at all.
I'd love it if
mdbook build
returned a non-zero error code on preprocessor failure.