1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 19:03:16 +02:00

Bail if plugin-files is set after plugins have been loaded.

We know the flag will be ignored but the user wants it to take effect.
This commit is contained in:
Shea Levy 2021-01-28 07:37:04 -05:00
parent a878c448d8
commit ec3497c1d6
No known key found for this signature in database
GPG key ID: 5C0BD6957D86FE27
2 changed files with 29 additions and 1 deletions

View file

@ -243,6 +243,14 @@ void MaxBuildJobsSetting::set(const std::string & str, bool append)
}
void PluginFilesSetting::set(const std::string & str, bool append)
{
if (pluginsLoaded)
throw UsageError("plugin-files set after plugins were loaded, you may need to move the flag before the subcommand");
BaseSetting<Paths>::set(str, append);
}
void initPlugins()
{
for (const auto & pluginFile : settings.pluginFiles.get()) {
@ -270,6 +278,9 @@ void initPlugins()
unknown settings. */
globalConfig.reapplyUnknownSettings();
globalConfig.warnUnknownSettings();
/* Tell the user if they try to set plugin-files after we've already loaded */
settings.pluginFiles.pluginsLoaded = true;
}
}