diff options
-rw-r--r-- | src/luarocks/util.lua | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua index 2592fcdc..1f7bd484 100644 --- a/src/luarocks/util.lua +++ b/src/luarocks/util.lua | |||
@@ -633,12 +633,16 @@ do | |||
633 | for _, d in ipairs(bindirs) do | 633 | for _, d in ipairs(bindirs) do |
634 | for _, name in ipairs(names) do | 634 | for _, name in ipairs(names) do |
635 | local lua_exe = d .. "/" .. name | 635 | local lua_exe = d .. "/" .. name |
636 | table.insert(tried, lua_exe) | 636 | local is_wrapper, err = util.lua_is_wrapper(lua_exe) |
637 | if not util.lua_is_wrapper(lua_exe) then | 637 | if is_wrapper == false then |
638 | local lv, ljv = util.check_lua_version(lua_exe, luaver) | 638 | local lv, ljv = util.check_lua_version(lua_exe, luaver) |
639 | if lv then | 639 | if lv then |
640 | return name, d, lv, ljv | 640 | return name, d, lv, ljv |
641 | end | 641 | end |
642 | elseif is_wrapper == true or err == nil then | ||
643 | table.insert(tried, lua_exe) | ||
644 | else | ||
645 | table.insert(tried, string.format("%-13s (%s)", lua_exe, err)) | ||
642 | end | 646 | end |
643 | end | 647 | end |
644 | end | 648 | end |
@@ -672,8 +676,11 @@ function util.lua_is_wrapper(interp) | |||
672 | if not fd then | 676 | if not fd then |
673 | return nil, err | 677 | return nil, err |
674 | end | 678 | end |
675 | local data = fd:read(1000) | 679 | local data, err = fd:read(1000) |
676 | fd:close() | 680 | fd:close() |
681 | if not data then | ||
682 | return nil, err | ||
683 | end | ||
677 | return not not data:match("LUAROCKS_SYSCONFDIR") | 684 | return not not data:match("LUAROCKS_SYSCONFDIR") |
678 | end | 685 | end |
679 | 686 | ||