builder/qemu: catch early exits of qemu
This commit is contained in:
parent
300897c116
commit
5ededd527a
|
@ -12,6 +12,7 @@ import (
|
|||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
"time"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
|
@ -116,6 +117,16 @@ func (d *QemuDriver) Qemu(qemuArgs ...string) error {
|
|||
d.vmEndCh = nil
|
||||
}()
|
||||
|
||||
// Wait at least a couple seconds for an early fail from Qemu so
|
||||
// we can report that.
|
||||
select {
|
||||
case exit := <-endCh:
|
||||
if exit != 0 {
|
||||
return fmt.Errorf("Qemu failed to start. Please run with logs to get more info.")
|
||||
}
|
||||
case <-time.After(2 * time.Second):
|
||||
}
|
||||
|
||||
// Setup our state so we know we are running
|
||||
d.vmCmd = cmd
|
||||
d.vmEndCh = endCh
|
||||
|
|
Loading…
Reference in New Issue