aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwzy <32936898+Freed-Wu@users.noreply.github.com>2025-04-03 08:39:36 +0800
committerGitHub <noreply@github.com>2025-04-02 21:39:36 -0300
commit1b9a3f2f0500196440c7f26c85366c651edd985e (patch)
tree6f0bc4d1326056940c39691cc9540792ca0b32cc
parent7ed653f010671b3a7245be9adcc70068c049ef68 (diff)
downloadluarocks-1b9a3f2f0500196440c7f26c85366c651edd985e.tar.gz
luarocks-1b9a3f2f0500196440c7f26c85366c651edd985e.tar.bz2
luarocks-1b9a3f2f0500196440c7f26c85366c651edd985e.zip
fs.unix: only create wrapper for lua scripts (#1738)
-rw-r--r--src/luarocks/fs/unix.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/luarocks/fs/unix.lua b/src/luarocks/fs/unix.lua
index 41a9ba8b..2c99ff0d 100644
--- a/src/luarocks/fs/unix.lua
+++ b/src/luarocks/fs/unix.lua
@@ -145,13 +145,14 @@ function unix.is_actual_binary(filename)
145 if not file then 145 if not file then
146 return true 146 return true
147 end 147 end
148 local first = file:read(2) 148 local first = file:read()
149 file:close() 149 file:close()
150 if not first then 150 if not first then
151 util.warning("could not read "..filename) 151 util.warning("could not read "..filename)
152 return true 152 return true
153 end 153 end
154 return first ~= "#!" 154 -- only create wrapper for lua scripts with `#!/usr/bin/env lua` or `#!/usr/bin/lua`
155 return first:match('^#!.*[ /]lua.*') == first
155end 156end
156 157
157function unix.copy_binary(filename, dest) 158function unix.copy_binary(filename, dest)