From dd406af2741e253847d58f40967806130ba21bf3 Mon Sep 17 00:00:00 2001
From: The Ghost of FOSS' Future
<163201376+sneedgroup-holder@users.noreply.github.com>
Date: Thu, 9 Jan 2025 01:05:27 +0000
Subject: [PATCH] Update qjs.c
---
qjs.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/qjs.c b/qjs.c
index dddffa1..3079edf 100644
--- a/qjs.c
+++ b/qjs.c
@@ -181,8 +181,7 @@ static int eval_file(JSContext *ctx, const char *filename, int module)
} else {
eval_flags = JS_EVAL_TYPE_GLOBAL;
}
-
- eval_buf(ctx, pf, strlen(pf), "", JS_EVAL_TYPE_MODULE);
+
ret = eval_buf(ctx, buf, buf_len, filename, eval_flags);
js_free(ctx, buf);
return ret;
@@ -663,6 +662,9 @@ start:
"globalThis.std = std;\n"
"globalThis.os = os;\n";
eval_buf(ctx, str, strlen(str), "", JS_EVAL_TYPE_MODULE);
+ eval_buf(ctx, pf, strlen(pf), "", JS_EVAL_TYPE_MODULE);
+ } else {
+ eval_buf(ctx, pf, strlen(pf), "", JS_EVAL_TYPE_MODULE);
}
for(i = 0; i < include_count; i++) {