From ccd1cd71845b8b9dde05a9259b60d3397754e06c Mon Sep 17 00:00:00 2001 From: Brooks Swinnerton Date: Sat, 31 Jul 2021 08:46:43 -0400 Subject: [PATCH] Embed execOptions as parameter to exec --- main.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/main.js b/main.js index 46b50eb..055fc18 100644 --- a/main.js +++ b/main.js @@ -81,19 +81,18 @@ async function main() { process.env.ANSIBLE_FORCE_COLOR = "True" - let output = '' - const execOptions = {} - execOptions.listeners = { - stdout: function(data) { - output += data.toString() - }, - stderr: function(data) { - output += data.toString() + let output = "" + await exec.exec(cmd.join(' '), null, { + listeners: { + stdout: function(data) { + output += data.toString() + }, + stderr: function(data) { + output += data.toString() + } } - } - - await exec.exec(cmd.join(' '), null, execOptions) - core.setOutput('output', output) + }) + core.setOutput("output", output) } catch (error) { core.setFailed(error.message) }