From 7f5702d58721df3d08b52df8aa4a9cdf1dede74f Mon Sep 17 00:00:00 2001 From: Kevin Longmuir Date: Tue, 9 Sep 2025 12:44:39 -0400 Subject: [PATCH] fix: save SBOM before performing scan for failure scenarios --- src/commands/scan/eol.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/commands/scan/eol.ts b/src/commands/scan/eol.ts index 6a6c122d..d7909159 100644 --- a/src/commands/scan/eol.ts +++ b/src/commands/scan/eol.ts @@ -77,6 +77,16 @@ export default class ScanEol extends Command { })); } + if (flags.saveSbom && !flags.file) { + const sbomPath = this.saveSbom(flags.dir, sbom); + this.log(`SBOM saved to ${sbomPath}`); + track('CLI SBOM Output Saved', (context) => ({ + command: context.command, + command_flags: context.command_flags, + sbom_output_path: sbomPath, + })); + } + if (!sbom.components?.length) { track('CLI EOL Scan Ended, No Components Found', (context) => ({ command: context.command, @@ -116,16 +126,6 @@ export default class ScanEol extends Command { })); } - if (flags.saveSbom && !flags.file) { - const sbomPath = this.saveSbom(flags.dir, sbom); - this.log(`SBOM saved to ${sbomPath}`); - track('CLI SBOM Output Saved', (context) => ({ - command: context.command, - command_flags: context.command_flags, - sbom_output_path: sbomPath, - })); - } - if (!this.jsonEnabled()) { this.displayResults(scan); }