mirror of
https://code.dumpstack.io/tools/appvm.git
synced 2024-11-26 14:13:01 +00:00
Improve error handling
This commit is contained in:
parent
9ac5d98ddb
commit
660c8a5dba
8
appvm.go
8
appvm.go
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user