Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed zero exit code when plugin not found #1122

Conversation

segfaultsourcery
Copy link
Contributor

In response to issue #893.

Copy link
Contributor

@azerupi azerupi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the tests, I see that missing backends were purposefully allowed. Before merging this, it would be great to check the reason and if someone relies on this behavior.

Otherwise ✔️

@segfaultsourcery
Copy link
Contributor Author

I noticed that too, but I'm honestly not sure who I should ask.

@azerupi
Copy link
Contributor

azerupi commented Jan 10, 2020

I am not sure either. @Michael-F-Bryan do you have an idea?

@segfaultsourcery
Copy link
Contributor Author

I guess an alternative could be to hide it behind a flag, like --abort-on-missing-plugin, or so, but I also know that excessive flags are (rightfully) frowned upon.

@Michael-F-Bryan
Copy link
Contributor

I'm surprised that missing backends are allowed. I guess one reason you may want that is if the book.toml enables link checking but you don't have mdbook-linkcheck installed. I could see how that might be annoying.

Instead of a command line flag, you could add an extra item to the [build] section of book.toml. For example missing-plugin = "ignore" (or "warn" or "fatal", where the default is "warn"). That'd involve creating a MissingPluginBehaviour enum and using that to dictate what happens if a backend/preprocessor doesn't exist.

@segfaultsourcery
Copy link
Contributor Author

It surprised me as well. It seems like a design decision that's definitely going to bite someone at some point (and it seems like it did). I like the idea with the [build] item. I'm tempted to write it now, but I think I'll wait for someone to decide for me.

Maybe @ehuss wants to decide? :)

@segfaultsourcery
Copy link
Contributor Author

Or maybe @Dylan-DPC ?

@Dylan-DPC-zz
Copy link

looks good to me. .will wait for a review from @ehuss

@ehuss
Copy link
Contributor

ehuss commented Jan 18, 2020

What about adding an optional key to the output table? Similar to preprocessor.*.renderers as a way to control whether or not the renderer is used.

[output.linkcheck]
optional = true

Or maybe ignore-if-missing if optional is too vague?

build.missing-plugin is also fine, but doesn't give much fine-grain control.

@Michael-F-Bryan
Copy link
Contributor

optional = true seems like an intuitive solution.

We'd need to update the docs so 3rd party backends (and preprocessors?) know about the convention and don't try to use the key as part of their config, although I doubt that happens in practice at the moment anyway.

@segfaultsourcery
Copy link
Contributor Author

segfaultsourcery commented Jan 18, 2020

Thank you for your input. How does this look? The default behavior is to require the backend and to stop if it's missing. Adding optional = true to its configuration allows it to be skipped.

@ehuss
Copy link
Contributor

ehuss commented Mar 9, 2020

Seems ok. Can you add documentation? And rebase on master.

@ehuss ehuss added this to the 0.4 milestone Mar 9, 2020
@segfaultsourcery
Copy link
Contributor Author

I wrote a little blurb in the docs, but I'm not sure how to go about rebasing to master.

@ehuss ehuss force-pushed the zero-exit-code-when-plugin-not-found-893 branch from 363cdca to 2732c5e Compare April 21, 2020 22:35
Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I made a few wording tweaks, and squashed the changes.

@ehuss ehuss merged commit 11f95f7 into rust-lang:master Apr 21, 2020
Ruin0x11 pushed a commit to Ruin0x11/mdBook that referenced this pull request Aug 30, 2020
…e-when-plugin-not-found-893

Fixed zero exit code when plugin not found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants