aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lauxlib.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lauxlib.js b/src/lauxlib.js
index 3851ee7..c6a975c 100644
--- a/src/lauxlib.js
+++ b/src/lauxlib.js
@@ -745,6 +745,8 @@ if (!WEB) {
lua.lua_pushliteral(L, `@${jsfilename}`);
try {
lf.f = fs.openSync(jsfilename, "r");
+ if (!fs.fstatSync(lf.f).isFile())
+ throw new Error(`${jsfilename} is not a readable file`);
} catch (e) {
return errfile(L, "open", fnameindex, e);
}