diff options
author | Ellie Huxtable <ellie@elliehuxtable.com> | 2023-08-14 09:58:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-14 09:58:57 +0100 |
commit | f3e9f274566ed8a5b2afa34e43727713c2f5f122 (patch) | |
tree | 805319f43c4fe9c3b915655677b6062dbe91697c | |
parent | b48de9bd9d89fb9b6a0044a1b251e5b2ff116387 (diff) |
Fix nix build (#1171)
I forgot nix builds in a sandbox, so my laziness earlier meant that the
nix build fails - sandbox has no git!
-rw-r--r-- | atuin/build.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/atuin/build.rs b/atuin/build.rs index 06df6463..f24cf1bf 100644 --- a/atuin/build.rs +++ b/atuin/build.rs @@ -1,10 +1,11 @@ use std::process::Command; fn main() { - let output = Command::new("git") - .args(["rev-parse", "HEAD"]) - .output() - .unwrap(); + let output = Command::new("git").args(["rev-parse", "HEAD"]).output(); - let git_hash = String::from_utf8(output.stdout).unwrap(); - println!("cargo:rustc-env=GIT_HASH={}", git_hash); + let sha = match output { + Ok(sha) => String::from_utf8(sha.stdout).unwrap(), + Err(_) => String::from("NO_GIT"), + }; + + println!("cargo:rustc-env=GIT_HASH={}", sha); } |