fix Store::realise returning empty

This commit is contained in:
do butterflies cry? 2026-04-03 21:19:53 +10:00
parent 3580e35287
commit 47c79e7d53
Signed by: cry
GPG key ID: F68745A836CA0412

View file

@ -108,7 +108,7 @@ impl Store {
/// ///
/// Returns an error if the path cannot be realized. /// Returns an error if the path cannot be realized.
/// ///
pub fn realise<F>( pub fn realise(
&self, &self,
path: &StorePath, path: &StorePath,
user_callback: fn(&str, &StorePath), user_callback: fn(&str, &StorePath),
@ -130,7 +130,7 @@ impl Store {
let callback = unsafe { (*userdata).inner }; let callback = unsafe { (*userdata).inner };
callback(output_name.as_ref(), &store_path); callback(output_name.as_ref(), &store_path);
(output_name, store_path); (unsafe {(*userdata).retval }).append((output_name, store_path));
}, },
|callback, |callback,
state: *mut __UserData, state: *mut __UserData,
@ -139,6 +139,8 @@ impl Store {
// WARNING: Using `write` instead of assignment via `=` // WARNING: Using `write` instead of assignment via `=`
// WARNING: to not call `drop` on the old, uninitialized value. // WARNING: to not call `drop` on the old, uninitialized value.
(&raw mut (*state).inner).write(user_callback); (&raw mut (*state).inner).write(user_callback);
// register return value
(&raw mut (*state).retval).write(Vec::new());
sys::nix_store_realise( sys::nix_store_realise(
ctx.as_ptr(), ctx.as_ptr(),