@@ -194,7 +194,10 @@ func (scanCmd *ScanCommand) indexFile(filePath string) (*xrayUtils.BinaryGraphNo
194194}
195195
196196func (scanCmd * ScanCommand ) Run () (err error ) {
197- return scanCmd .RunAndRecordResults (func (scanResults * utils.Results ) error {
197+ return scanCmd .RunAndRecordResults (utils .Binary , func (scanResults * utils.Results ) (err error ) {
198+ if err = utils .RecordSarifOutput (scanResults ); err != nil {
199+ return
200+ }
198201 return utils .RecordSecurityCommandSummary (utils .NewBinaryScanSummary (
199202 scanResults ,
200203 scanCmd .serverDetails ,
@@ -204,7 +207,7 @@ func (scanCmd *ScanCommand) Run() (err error) {
204207 })
205208}
206209
207- func (scanCmd * ScanCommand ) RunAndRecordResults (recordResFunc func (scanResults * utils.Results ) error ) (err error ) {
210+ func (scanCmd * ScanCommand ) RunAndRecordResults (cmdType utils. CommandType , recordResFunc func (scanResults * utils.Results ) error ) (err error ) {
208211 defer func () {
209212 if err != nil {
210213 var e * exec.ExitError
@@ -220,7 +223,7 @@ func (scanCmd *ScanCommand) RunAndRecordResults(recordResFunc func(scanResults *
220223 return err
221224 }
222225
223- scanResults := utils .NewAuditResults ()
226+ scanResults := utils .NewAuditResults (cmdType )
224227 scanResults .XrayVersion = xrayVersion
225228 if scanCmd .analyticsMetricsService != nil {
226229 scanResults .MultiScanId = scanCmd .analyticsMetricsService .GetMsi ()
@@ -323,15 +326,10 @@ func (scanCmd *ScanCommand) RunAndRecordResults(recordResFunc func(scanResults *
323326 SetIncludeLicenses (scanCmd .includeLicenses ).
324327 SetPrintExtendedTable (scanCmd .printExtendedTable ).
325328 SetIsMultipleRootProject (scanResults .IsMultipleProject ()).
326- SetScanType (services .Binary ).
327329 PrintScanResults (); err != nil {
328330 return
329331 }
330332
331- if err != nil {
332- return err
333- }
334-
335333 if err = recordResFunc (scanResults ); err != nil {
336334 return err
337335 }
0 commit comments