Skip to content

Commit dba0485

Browse files
authored
Be safer when getting version info
1 parent 4611962 commit dba0485

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/BinaryBuilder.jl

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,16 @@ function get_bb_version()
5858
gitsha = string(LibGit2.GitHash(LibGit2.GitCommit(repo, "HEAD")))
5959
return VersionNumber("$(version)-git-$(gitsha[1:10])")
6060
catch
61-
# Settle for the treehash otherwise
62-
env = Pkg.Types.Context().env
63-
bb_uuid = Pkg.Types.UUID("12aac903-9f7c-5d81-afc2-d9565ea332ae")
64-
treehash = bytes2hex(env.manifest[bb_uuid].tree_hash.bytes)
65-
return VersionNumber("$(version)-tree-$(treehash[1:10])")
61+
try
62+
# Settle for the treehash otherwise
63+
env = Pkg.Types.Context().env
64+
bb_uuid = Pkg.Types.UUID("12aac903-9f7c-5d81-afc2-d9565ea332ae")
65+
treehash = bytes2hex(env.manifest[bb_uuid].tree_hash.bytes)
66+
return VersionNumber("$(version)-tree-$(treehash[1:10])")
67+
catch
68+
# Something went so wrong, we can't get any of that.
69+
return VersionNumber(version)
70+
end
6671
end
6772
end
6873

0 commit comments

Comments
 (0)