Skip to content

Commit

Permalink
testing26
Browse files Browse the repository at this point in the history
  • Loading branch information
an1l4 committed Aug 22, 2023
1 parent 93f6d13 commit ead761a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions agent/kubviz/trivy_sbom.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"bytes"
"encoding/json"
"log"
"os/exec"
Expand Down Expand Up @@ -31,13 +32,20 @@ func publishTrivySbomReport(report model.Sbom, js nats.JetStreamContext, errCh c
func executeCommandSbom(command string) ([]byte, error) {
cmd := exec.Command("/bin/sh", "-c", command)
//cmd := exec.Command(command)
stdout, err := cmd.Output()
var outc, errc bytes.Buffer
cmd.Stdout = &outc
cmd.Stderr = &errc
log.Println("*******before ece command")
//stdout, err := cmd.Output()
err := cmd.Run()
log.Println("*******command ececuted")

if err != nil {
log.Println("Execute Command Error", err.Error())
}
log.Println("*******output", outc.String(), errc.String())

return stdout, err
return outc.Bytes(), err
}

// func RunTrivySbomScan(config *rest.Config, js nats.JetStreamContext, wg *sync.WaitGroup, errCh chan error) {
Expand Down

0 comments on commit ead761a

Please sign in to comment.