mirror of
https://github.com/NixOS/nix.git
synced 2025-11-20 17:29:36 +01:00
C API: Propagate nix_store_realise build errors
This commit is contained in:
parent
12293a8b11
commit
6fa03765ed
3 changed files with 145 additions and 0 deletions
|
|
@ -173,6 +173,14 @@ nix_err nix_store_realise(
|
|||
const auto nixStore = store->ptr;
|
||||
auto results = nixStore->buildPathsWithResults(paths, nix::bmNormal, nixStore);
|
||||
|
||||
assert(results.size() == 1);
|
||||
|
||||
// Check if any builds failed
|
||||
for (auto & result : results) {
|
||||
if (!result.success())
|
||||
result.rethrow();
|
||||
}
|
||||
|
||||
if (callback) {
|
||||
for (const auto & result : results) {
|
||||
for (const auto & [outputName, realisation] : result.builtOutputs) {
|
||||
|
|
|
|||
|
|
@ -186,6 +186,8 @@ nix_err nix_store_real_path(
|
|||
* @param[in] path Path to build
|
||||
* @param[in] userdata data to pass to every callback invocation
|
||||
* @param[in] callback called for every realised output
|
||||
* @return NIX_OK if the build succeeded, or an error code if the build/scheduling/outputs/copying/etc failed.
|
||||
* On error, the callback is never invoked and error information is stored in context.
|
||||
*/
|
||||
nix_err nix_store_realise(
|
||||
nix_c_context * context,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue