From 2a40712346a231d6d9f5f520ac7abadbc19b7124 Mon Sep 17 00:00:00 2001 From: Squibid Date: Sat, 6 Dec 2025 16:05:53 -0500 Subject: [PATCH] don't try to access result of nix store if it's not available --- src/NixStore.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/NixStore.zig b/src/NixStore.zig index 0fd66b9..b7db990 100644 --- a/src/NixStore.zig +++ b/src/NixStore.zig @@ -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 }