1
0

fix: trim control commands from qemu logs

This commit is contained in:
dump_stack() 2024-10-08 22:36:12 +00:00
parent ef4a9364a1
commit c53e0cc99b
Signed by: dump_stack
GPG Key ID: C9905BA72B5E02BB

View File

@ -396,7 +396,7 @@ func (q *System) Start() (err error) {
go func() {
scanner := bufio.NewScanner(q.pipe.stdout)
for scanner.Scan() {
m := scanner.Text()
m := strings.TrimSpace(scanner.Text())
q.handleQemuOutput(m)
q.Stdout += m + "\n"
q.Log.Trace().Str("stdout", m).Msg("qemu")
@ -407,7 +407,7 @@ func (q *System) Start() (err error) {
go func() {
scanner := bufio.NewScanner(q.pipe.stderr)
for scanner.Scan() {
m := scanner.Text()
m := strings.TrimSpace(scanner.Text())
q.handleQemuOutput(m)
q.Stderr += m + "\n"
q.Log.Trace().Str("stderr", m).Msg("qemu")
@ -560,7 +560,7 @@ func (q System) Command(user, cmd string) (output string, err error) {
scanner := bufio.NewScanner(stdout)
for scanner.Scan() {
m := scanner.Text()
m := strings.TrimSpace(scanner.Text())
q.handleCommandsOutput(m)
output += m + "\n"
flog.Trace().Str("stdout", m).Msg("qemu command")
@ -574,7 +574,7 @@ func (q System) Command(user, cmd string) (output string, err error) {
scanner := bufio.NewScanner(stderr)
for scanner.Scan() {
m := scanner.Text()
m := strings.TrimSpace(scanner.Text())
q.handleCommandsOutput(m)
output += m + "\n"
// Note: it prints stderr as stdout