From bacc22f7cb26d701c4dbf8609b8e01a030ea6f34 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Tue, 2 May 2017 09:30:53 +0200 Subject: Fixed call to execSync to use stdin/out/err --- src/loslib.js | 19 ++++++++++++------- 1 file 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; } }; -- cgit v1.2.3-70-g09d2