Skip to content

Commit ee037b1

Browse files
author
Caspar van Leeuwen
committed
Make compatible with Lua 5.2 and onwards as well
1 parent 64e17c4 commit ee037b1

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

create_lmodsitepackage.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,16 @@
194194
local script = pathJoin(eessi_prefix, 'scripts', 'gpu_support', 'nvidia', 'get_cuda_driver_version.sh')
195195
-- Check return code first. We don't want source_sh to raise an LmodError, we just print
196196
-- an LmodWarning stating we couldn't do a proper version compatibility check
197-
local rc = os.execute("bash -c 'source " .. script .. "'")
198-
if rc == 0 then
197+
local r1, r2, r3 = os.execute("bash -c 'source " .. script .. "'")
198+
local exit_code = 0
199+
if type(r1) == "number" then
200+
-- Lua 5.1 or earlier, this is our exit code
201+
exit_code = r1
202+
else
203+
-- Lua 5.2 or later, r3 is our exit code
204+
exit_code = r3
205+
end
206+
if exit_code == 0 then
199207
source_sh("bash", script)
200208
end
201209
end

0 commit comments

Comments
 (0)