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 }