aboutsummaryrefslogtreecommitdiffstats
path: root/tools/execute_js_code.js
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-11-25 08:21:58 +0800
committerGitHub <noreply@github.com>2024-11-25 08:21:58 +0800
commitecf7233401ebe273fa292b8208651395d99ddff9 (patch)
tree483abfafb341b6cea7bdd9102f5e5e13473919c2 /tools/execute_js_code.js
parent4e0c6e752d1cf10cd30d67a6e6a1af21a601ae79 (diff)
downloadllm-functions-docker-ecf7233401ebe273fa292b8208651395d99ddff9.tar.gz
fix: execute js/py code (#129)
Diffstat (limited to 'tools/execute_js_code.js')
-rw-r--r--tools/execute_js_code.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/execute_js_code.js b/tools/execute_js_code.js
index 6f04ade..0b7557b 100644
--- a/tools/execute_js_code.js
+++ b/tools/execute_js_code.js
@@ -12,8 +12,11 @@ exports.run = function run({ code }) {
if (callback) callback();
};
- eval(code);
-
+ const value = eval(code);
+ if (value !== undefined) {
+ output += value;
+ }
+
process.stdout.write = oldStdoutWrite;
return output;
}