Skip to content

Commit

Permalink
fix: subsitute fatal error with warning when version stamp missing
Browse files Browse the repository at this point in the history
This means Zenroom can still run when there was no version stamp found
at build, but it will print out a warning
  • Loading branch information
jaromil committed Nov 26, 2024
1 parent 893bf11 commit b3898db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/lua/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,14 @@ end
-- ZEN = { assert = assert } -- zencode shim when not loaded
require('zenroom_common')
MACHINE = require('statemachine')

-- Stamp the VM with version (set externally at build)
-- every official Dyne.org release should have this
SEMVER = require('semver')
-- returns nil and a warning if no VERSION found
_G['ZENROOM_VERSION'] = SEMVER(VERSION)

-- Cap the limit of iterations in branches
_G['MAXITER'] = tonumber(STR_MAXITER)

OCTET = require('zenroom_octet')
Expand Down
6 changes: 5 additions & 1 deletion src/lua/semver.lua
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,11 @@ function mt:__pow(other)
end

local function new(major, minor, patch, prerelease, build)
assert(major, "At least one parameter is needed")
if not major then
warn("Zenroom build misses version information")
warn("Running VM is not an official release by Dyne.org")
return nil
end
local result = { }
if type(major) == 'string' then
result.original = major
Expand Down

0 comments on commit b3898db

Please sign in to comment.