aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2021-12-18 10:56:10 -0700
committerGitHub <noreply@github.com>2021-12-18 10:56:10 -0700
commiteceb0b305e7358e411df7f0f2040e8ed702f631b (patch)
treebd2d2f84e1dab6ef1e033f954ca546160f422ccf
parent2abd17813e1e71b88f57cc602f6acab25f57b37b (diff)
downloadrneovim-eceb0b305e7358e411df7f0f2040e8ed702f631b.tar.gz
rneovim-eceb0b305e7358e411df7f0f2040e8ed702f631b.tar.bz2
rneovim-eceb0b305e7358e411df7f0f2040e8ed702f631b.zip
fix(build): check for empty value of LUAC_PRG (#16711)
If the LUAC_PRG environment variable is defined, but empty, compilation would still be attempted but would be malformed. This results in garbage bytes being included. Fix this by checking that LUAC_PRG is both defined *and* non-empty.
-rw-r--r--src/nvim/generators/gen_char_blob.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nvim/generators/gen_char_blob.lua b/src/nvim/generators/gen_char_blob.lua
index 70c034abc5..3ec1ff2caf 100644
--- a/src/nvim/generators/gen_char_blob.lua
+++ b/src/nvim/generators/gen_char_blob.lua
@@ -28,6 +28,7 @@ local target = io.open(target_file, 'w')
target:write('#include <stdint.h>\n\n')
+local warn_on_missing_compiler = true
local varnames = {}
for argi = 2, #arg, 2 do
local source_file = arg[argi]
@@ -42,10 +43,11 @@ for argi = 2, #arg, 2 do
local output
if options.c then
local luac = os.getenv("LUAC_PRG")
- if luac then
+ if luac and luac ~= "" then
output = io.popen(luac:format(source_file), "r"):read("*a")
- else
- print("LUAC_PRG is undefined")
+ elseif warn_on_missing_compiler then
+ print("LUAC_PRG is missing, embedding raw source")
+ warn_on_missing_compiler = false
end
end