Implement qemu-system stderr log passthrough

This commit is contained in:
AlexSSD7 2023-09-06 13:53:11 +01:00
commit ec99bc4ef1
5 changed files with 11 additions and 6 deletions

View file

@ -22,6 +22,7 @@ import (
"context"
"fmt"
"io"
"os"
"os/exec"
"sync"
"sync/atomic"
@ -99,7 +100,7 @@ type Config struct {
SSHUpTimeout time.Duration
// Mostly debug-related options.
ShowDisplay bool
Debug bool // This will show the display and forward all QEMU warnings/errors to stderr.
InstallBaseUtilities bool
}
@ -176,6 +177,10 @@ func NewVM(logger *slog.Logger, cfg Config) (*VM, error) {
stderrBuf := bytes.NewBuffer(nil)
cmd.Stderr = stderrBuf
if cfg.Debug {
cmd.Stderr = io.MultiWriter(cmd.Stderr, os.Stderr)
}
// This function is OS-specific.
osspecifics.SetNewProcessGroupCmd(cmd)