mirror of
https://code.dumpstack.io/tools/appvm.git
synced 2024-11-23 16:41:29 +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
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
@ -190,6 +191,13 @@ func generateVM(name string, verbose bool) (realpath, reginfo, qcow2 string, err
|
||||||
status := <-command.Start()
|
status := <-command.Start()
|
||||||
if status.Error != nil || status.Exit != 0 {
|
if status.Error != nil || status.Exit != 0 {
|
||||||
log.Println(status.Error, status.Stdout, status.Stderr)
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue