diff --git a/with-post-step/main.js b/with-post-step/main.js index cdef47a..0fa6d9e 100644 --- a/with-post-step/main.js +++ b/with-post-step/main.js @@ -24,16 +24,15 @@ * * https://github.com/docker/login-action/issues/72 * * * https://github.com/actions/runner/issues/1478 * * ================================================================================================================== */ -const { exec } = require("child_process"); +const { spawn } = require("child_process"); -function run(cmd) { - exec(cmd, (error, stdout, stderr) => { - if ( stdout.length !== 0 ) { console.log(`${stdout}`); } - if ( stderr.length !== 0 ) { console.error(`${stderr}`); } - if (error) { - process.exitCode = error.code; - console.error(`${error}`); - } +function run(cmdline) { + var args = cmdline.split(" "); + const cmd = args.shift(); + + const subprocess = spawn(cmd, args, { stdio: "inherit" }); + subprocess.on("exit", (exitCode) => { + process.exitCode = exitCode; }); }