Created
February 19, 2012 18:56
-
-
Save hishamhm/1865176 to your computer and use it in GitHub Desktop.
LuaRocks 2.0.8-rc1: Simplify detection of binary files for determining arch suffix of packed rocks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/luarocks/fs/unix.lua b/src/luarocks/fs/unix.lua | |
index 979fd16..88bafaf 100644 | |
--- a/src/luarocks/fs/unix.lua | |
+++ b/src/luarocks/fs/unix.lua | |
@@ -71,30 +71,16 @@ function is_actual_binary(filename) | |
return false | |
end | |
local file = io.open(filename) | |
- if file then | |
- local found = false | |
- local first = file:read() | |
- if not first then | |
- file:close() | |
- util.printerr("Warning: could not read "..filename) | |
- return false | |
- end | |
- if first:match("#!.*lua") then | |
- file:close() | |
- return true | |
- elseif first:match("#!/bin/sh") then | |
- local line = file:read() | |
- line = file:read() | |
- if not(line and line:match("LUA_PATH")) then | |
- file:close() | |
- return true | |
- end | |
- end | |
- file:close() | |
- else | |
+ if not file then | |
+ return true | |
+ end | |
+ local first = file:read(2) | |
+ file:close() | |
+ if not first then | |
+ util.printerr("Warning: could not read "..filename) | |
return true | |
end | |
- return false | |
+ return first ~= "#!" | |
end | |
function copy_binary(filename, dest) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment