aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-05-02 09:30:53 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-05-02 09:30:53 +0200
commitbacc22f7cb26d701c4dbf8609b8e01a030ea6f34 (patch)
tree8b06b706d88e55865f9026048d61f497d4667fec /src
parent6775b78235bfa4bc0fcd2c44a1810d8d9fc61b69 (diff)
downloadfengari-bacc22f7cb26d701c4dbf8609b8e01a030ea6f34.tar.gz
fengari-bacc22f7cb26d701c4dbf8609b8e01a030ea6f34.tar.bz2
fengari-bacc22f7cb26d701c4dbf8609b8e01a030ea6f34.zip
Fixed call to execSync to use stdin/out/err
Diffstat (limited to 'src')
-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;
}
};