don't try to access result of nix store if it's not available
This commit is contained in:
parent
76b00eb368
commit
2a40712346
1 changed files with 2 additions and 0 deletions
|
|
@ -14,6 +14,8 @@ pub fn add(path: []const u8) error{Failure}![]const u8 {
|
||||||
.argv = &[_][]const u8{ "nix", "store", "add", path },
|
.argv = &[_][]const u8{ "nix", "store", "add", path },
|
||||||
}) catch return error.Failure;
|
}) 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
|
return res.stdout[0 .. res.stdout.len - 1]; // to chop off the \n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue