aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/loslib.js19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/loslib.js b/src/loslib.js
index 854e51e..4c3331d 100644
--- a/src/loslib.js
+++ b/src/loslib.js
@@ -162,27 +162,32 @@ if (typeof require === "function") {
if (child_process) {
const os_execute = function(L) {
let cmd = lauxlib.luaL_optstring(L, 1, null);
- let out = false;
if (cmd !== null) {
try {
- out = child_process.execSync(lua.to_jsstring(cmd));
+ child_process.execSync(
+ lua.to_jsstring(cmd),
+ {
+ stdio: [process.stdin, process.stdout, process.stderr]
+ }
+ );
} catch (e) {
return lauxlib.luaL_execresult(L, false, e);
}
- if (out) console.log(out.asciiSlice());
-
return lauxlib.luaL_execresult(L, true);
} else {
try {
- out = child_process.execSync(lua.to_jsstring(cmd));
+ child_process.execSync(
+ lua.to_jsstring(cmd),
+ {
+ stdio: [process.stdin, process.stdout, process.stderr]
+ }
+ );
lua.lua_pushboolean(L, 1);
} catch (e) {
lua.lua_pushboolean(L, 0);
}
- if (out) console.log(out.asciiSlice());
-
return 1;
}
};