Skip to content

Commit

Permalink
Fix provider log cmd (#206)
Browse files Browse the repository at this point in the history
* fix provider log cmd

Signed-off-by: Emily McMullan <[email protected]>

* set cmd out to file

Signed-off-by: Emily McMullan <[email protected]>

---------

Signed-off-by: Emily McMullan <[email protected]>
  • Loading branch information
eemcmullan authored Apr 26, 2024
1 parent 1c84548 commit 256fb62
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cmd/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -1294,17 +1294,21 @@ func (a *analyzeCommand) getProviderLogs(ctx context.Context) error {
return nil
}
providerLogFilePath := filepath.Join(a.output, "provider.log")
providerLog, err := os.Create(providerLogFilePath)
if err != nil {
return fmt.Errorf("failed creating provider log file at %s", providerLogFilePath)
}
defer providerLog.Close()
a.log.V(1).Info("getting provider container logs",
"container", a.providerContainerNames[0])

// send each provider logs to log file
cmd := exec.CommandContext(
ctx,
Settings.PodmanBinary,
"logs",
a.providerContainerNames[0],
"&>",
providerLogFilePath)
a.providerContainerNames[0])

cmd.Stdout = providerLog
cmd.Stderr = providerLog
return cmd.Run()
}

0 comments on commit 256fb62

Please sign in to comment.