1
0
Fork 0

Improve error handling

master
dump_stack() 2019-05-12 00:10:25 +00:00
parent 9ac5d98ddb
commit 660c8a5dba
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC
1 changed files with 8 additions and 0 deletions

View File

@ -8,6 +8,7 @@
package main
import (
"errors"
"fmt"
"io"
"io/ioutil"
@ -190,6 +191,13 @@ func generateVM(name string, verbose bool) (realpath, reginfo, qcow2 string, err
status := <-command.Start()
if status.Error != nil || status.Exit != 0 {
log.Println(status.Error, status.Stdout, status.Stderr)
if status.Error != nil {
err = status.Error
} else {
s := fmt.Sprintf("ret code: %d, out: %v, err: %v",
status.Exit, status.Stdout, status.Stderr)
err = errors.New(s)
}
return
}