From 5fcc87498554868f0b5637ddf7aa4561ef647339 Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Sat, 5 Oct 2024 20:28:48 +0000 Subject: [PATCH] fix: qemu timeout priorities --- cmd/pew.go | 10 +++++++--- qemu/qemu-kernel.go | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cmd/pew.go b/cmd/pew.go index 000a4e5..29d4fc9 100644 --- a/cmd/pew.go +++ b/cmd/pew.go @@ -230,9 +230,13 @@ func (cmd *PewCmd) Run(g *Globals) (err error) { ka.Targets = []artifact.Target{km} } - // TODO there was a lib for merge structures - ka.Qemu.Timeout.Duration = g.Config.Qemu.Timeout.Duration - ka.Docker.Timeout.Duration = g.Config.Docker.Timeout.Duration + if ka.Qemu.Timeout.Duration == 0 { + ka.Qemu.Timeout.Duration = g.Config.Qemu.Timeout.Duration + } + + if ka.Docker.Timeout.Duration == 0 { + ka.Docker.Timeout.Duration = g.Config.Docker.Timeout.Duration + } if cmd.QemuTimeout != 0 { log.Info().Msgf("Set qemu timeout to %s", cmd.QemuTimeout) diff --git a/qemu/qemu-kernel.go b/qemu/qemu-kernel.go index e24d8b0..59218b9 100644 --- a/qemu/qemu-kernel.go +++ b/qemu/qemu-kernel.go @@ -342,6 +342,7 @@ func (q *System) Start() (err error) { if q.Timeout != 0 { go func() { + q.Log.Debug().Msgf("qemu wait for %s before kill", q.Timeout) time.Sleep(q.Timeout) q.KilledByTimeout = true q.Stop()