packer/rpc: don't panic on failed Ui calls

This commit is contained in:
Mitchell Hashimoto 2013-08-23 14:39:59 -07:00
parent 4513a2509e
commit d3fff7d145
2 changed files with 6 additions and 5 deletions

View File

@ -160,7 +160,7 @@ func (c *comm) Upload(path string, input io.Reader) error {
return err return err
} }
if _, err := io.Copy(w, input_memory); err != nil{ if _, err := io.Copy(w, input_memory); err != nil {
return err return err
} }

View File

@ -2,6 +2,7 @@ package rpc
import ( import (
"github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/packer"
"log"
"net/rpc" "net/rpc"
) )
@ -30,7 +31,7 @@ func (u *Ui) Ask(query string) (result string, err error) {
func (u *Ui) Error(message string) { func (u *Ui) Error(message string) {
if err := u.client.Call("Ui.Error", message, new(interface{})); err != nil { if err := u.client.Call("Ui.Error", message, new(interface{})); err != nil {
panic(err) log.Printf("Error in Ui RPC call: %s", err)
} }
} }
@ -41,19 +42,19 @@ func (u *Ui) Machine(t string, args ...string) {
} }
if err := u.client.Call("Ui.Machine", rpcArgs, new(interface{})); err != nil { if err := u.client.Call("Ui.Machine", rpcArgs, new(interface{})); err != nil {
panic(err) log.Printf("Error in Ui RPC call: %s", err)
} }
} }
func (u *Ui) Message(message string) { func (u *Ui) Message(message string) {
if err := u.client.Call("Ui.Message", message, new(interface{})); err != nil { if err := u.client.Call("Ui.Message", message, new(interface{})); err != nil {
panic(err) log.Printf("Error in Ui RPC call: %s", err)
} }
} }
func (u *Ui) Say(message string) { func (u *Ui) Say(message string) {
if err := u.client.Call("Ui.Say", message, new(interface{})); err != nil { if err := u.client.Call("Ui.Say", message, new(interface{})); err != nil {
panic(err) log.Printf("Error in Ui RPC call: %s", err)
} }
} }