Add logger debug output

This commit is contained in:
HikariKnight 2023-04-10 14:26:50 +02:00
parent 27a52cda1f
commit 639d056abe
7 changed files with 71 additions and 18 deletions

View file

@ -10,11 +10,14 @@ import (
"strings"
"github.com/HikariKnight/ls-iommu/pkg/errorcheck"
"github.com/HikariKnight/quickpassthrough/internal/logger"
"github.com/charmbracelet/bubbles/list"
)
func getIOMMU(args ...string) []string {
var stdout, stderr bytes.Buffer
// Write to logger
logger.Printf("Executing: utils/ls-iommu %s", strings.Join(args, " "))
// Configure the ls-iommu command
cmd := exec.Command("utils/ls-iommu", args...)
@ -31,6 +34,9 @@ func getIOMMU(args ...string) []string {
var items []string
output, _ := io.ReadAll(&stdout)
// Write to logger
logger.Printf("ls-iommu query returned\n%s", string(output))
// Parse the output line by line
scanner := bufio.NewScanner(strings.NewReader(string(output)))
for scanner.Scan() {