Code update

This commit is contained in:
Daan Selen
2025-08-09 00:33:26 +02:00
parent d9c972fcaf
commit 6e7555e536
2 changed files with 14 additions and 6 deletions

View File

@@ -27617,15 +27617,19 @@ async function runScoutCommand(commands, image, format, outputFile) {
core.setOutput('result-file', resultPath); core.setOutput('result-file', resultPath);
for (const cmd of commands) { for (const cmd of commands) {
const args = ['scout', cmd, image];
if (cmd == 'cves') {
args.push('--format', format);
}
if (outputFile) { 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) { if (res.stderr && res.stderr.length > 0) {
throw new Error(res.stderr); throw new Error(res.stderr);
} }
fs.appendFile(resultPath, res.stdout); fs.appendFile(resultPath, res.stdout);
} else { } else {
await exec.exec('docker', ['scout', cmd, image, '--format', format]); await exec.exec('docker', args);
} }
} }
return resultPath; return resultPath;

View File

@@ -60,15 +60,19 @@ async function runScoutCommand(commands, image, format, outputFile) {
core.setOutput('result-file', resultPath); core.setOutput('result-file', resultPath);
for (const cmd of commands) { for (const cmd of commands) {
const args = ['scout', cmd, image];
if (cmd == 'cves') {
args.push('--format', format);
}
if (outputFile) { 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) { if (res.stderr && res.stderr.length > 0) {
throw new Error(res.stderr); throw new Error(res.stderr);
} }
fs.appendFile(resultPath, res.stdout); fs.appendFile(resultPath, res.stdout);
} else { } else {
await exec.exec('docker', ['scout', cmd, image, '--format', format]); await exec.exec('docker', args);
} }
} }
return resultPath; return resultPath;