Skip to content

Commit 187ba89

Browse files
committed
Don't force shebang line in amalgamated script.
There may be Lua implementations that don't support shebang lines in files or situations where you want to load amalgamated Lua code from somewhere other than a file.
1 parent 637c0d8 commit 187ba89

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/amalg.lua

+7-6
Original file line numberDiff line numberDiff line change
@@ -395,17 +395,18 @@ local function amalgamate( ... )
395395
out = assert( io.open( oname, "w" ) )
396396
end
397397

398-
-- If a main script is to be embedded, this includes a shebang line
399-
-- so that the resulting amalgamation can be run without explicitly
400-
-- specifying the interpreter on unixoid systems.
398+
-- If a main script is to be embedded, this includes the same
399+
-- shebang line that was used in the main script, so that the
400+
-- resulting amalgamation can be run without explicitly
401+
-- specifying the interpreter on unixoid systems (if a shebang
402+
-- line was specified in the first place, that is).
401403
local script_bytes, script_binary, shebang
402404
if script then
403405
script_bytes, script_binary, shebang = readluafile( script )
404406
if shebang then
405-
out:write( shebang, "\n\ndo\n\n" )
406-
else
407-
out:write( "#!/usr/bin/env lua\n\ndo\n\n" )
407+
out:write( shebang, "\n\n" )
408408
end
409+
out:write( "do\n\n" )
409410
end
410411

411412
-- Sort modules alphabetically. Modules will be embedded in

0 commit comments

Comments
 (0)