don't try to access result of nix store if it's not available

This commit is contained in:
Squibid 2025-12-06 16:05:53 -05:00
parent 76b00eb368
commit 2a40712346
Signed by: squibid
GPG key ID: BECE5684D3C4005D

View file

@ -14,6 +14,8 @@ pub fn add(path: []const u8) error{Failure}![]const u8 {
.argv = &[_][]const u8{ "nix", "store", "add", path },
}) catch return error.Failure;
if (res.term != .Exited or res.term.Exited != 0) return error.Failure;
if (res.stdout.len == 0) return error.Failure;
return res.stdout[0 .. res.stdout.len - 1]; // to chop off the \n
}