From 6e7555e53644ddc544ad8211490d6e925ed05052 Mon Sep 17 00:00:00 2001 From: Daan Selen Date: Sat, 9 Aug 2025 00:33:26 +0200 Subject: [PATCH] Code update --- docker-scout/dist/index.js | 10 +++++++--- docker-scout/src/index.js | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/docker-scout/dist/index.js b/docker-scout/dist/index.js index afdba44..8647d8a 100644 --- a/docker-scout/dist/index.js +++ b/docker-scout/dist/index.js @@ -27617,15 +27617,19 @@ async function runScoutCommand(commands, image, format, outputFile) { core.setOutput('result-file', resultPath); for (const cmd of commands) { + const args = ['scout', cmd, image]; + if (cmd == 'cves') { + args.push('--format', format); + } + if (outputFile) { - const res = await exec.getExecOutput('docker', ['scout', cmd, image, '--format', format], { silent: true }); + const res = await exec.getExecOutput('docker', args, { silent: true }); if (res.stderr && res.stderr.length > 0) { throw new Error(res.stderr); } - fs.appendFile(resultPath, res.stdout); } else { - await exec.exec('docker', ['scout', cmd, image, '--format', format]); + await exec.exec('docker', args); } } return resultPath; diff --git a/docker-scout/src/index.js b/docker-scout/src/index.js index 626ea5a..789d53f 100644 --- a/docker-scout/src/index.js +++ b/docker-scout/src/index.js @@ -60,15 +60,19 @@ async function runScoutCommand(commands, image, format, outputFile) { core.setOutput('result-file', resultPath); for (const cmd of commands) { + const args = ['scout', cmd, image]; + if (cmd == 'cves') { + args.push('--format', format); + } + if (outputFile) { - const res = await exec.getExecOutput('docker', ['scout', cmd, image, '--format', format], { silent: true }); + const res = await exec.getExecOutput('docker', args, { silent: true }); if (res.stderr && res.stderr.length > 0) { throw new Error(res.stderr); } - fs.appendFile(resultPath, res.stdout); } else { - await exec.exec('docker', ['scout', cmd, image, '--format', format]); + await exec.exec('docker', args); } } return resultPath;