mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
libstore: Make sure that initNix has been called
Prevent bugs like https://github.com/cachix/cachix/pull/477
This commit is contained in:
parent
26c7602c39
commit
aba6eb348e
5 changed files with 25 additions and 0 deletions
|
@ -291,4 +291,18 @@ void initPlugins()
|
|||
settings.pluginFiles.pluginsLoaded = true;
|
||||
}
|
||||
|
||||
static bool initLibStoreDone = false;
|
||||
|
||||
void assertLibStoreInitialized() {
|
||||
if (!initLibStoreDone) {
|
||||
printError("The program must call nix::initNix() before calling any libstore library functions.");
|
||||
abort();
|
||||
};
|
||||
}
|
||||
|
||||
void initLibStore() {
|
||||
initLibStoreDone = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue