Skip to content

Bug: Preprocessor failure returns a status code of 0 #1872

Open
@markmandel

Description

@markmandel

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:

➜  docs git:(main) mdbook build
2022-08-08 17:55:52 [INFO] (mdbook::book): Book building has started
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: No such file or directory (os error 2)', src/main.rs:121:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2022-08-08 17:56:11 [INFO] (mdbook::book): Running the html backend
➜  docs git:(main) echo $?
0
➜  docs git:(main) ./preprocessor.sh
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: No such file or directory (os error 2)', src/main.rs:121:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
➜  docs git:(main) echo $?
101

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions