Index: utils/ssh/run.go |
=== modified file 'utils/ssh/run.go' |
--- utils/ssh/run.go 2014-01-15 02:38:58 +0000 |
+++ utils/ssh/run.go 2014-02-12 18:03:05 +0000 |
@@ -5,12 +5,12 @@ |
import ( |
"bytes" |
- "fmt" |
"os/exec" |
"strings" |
"syscall" |
"time" |
+ "launchpad.net/errgo/errors" |
utilexec "launchpad.net/juju-core/utils/exec" |
) |
@@ -30,7 +30,7 @@ |
func ExecuteCommandOnMachine(params ExecParams) (result utilexec.ExecResponse, err error) { |
// execute bash accepting commands on stdin |
if params.Host == "" { |
- return result, fmt.Errorf("missing host address") |
+ return result, errors.Newf("missing host address") |
} |
logger.Debugf("execute on %s", params.Host) |
var options Options |
@@ -45,7 +45,7 @@ |
command.Stdin = strings.NewReader(params.Command + "\n") |
if err = command.Start(); err != nil { |
- return result, err |
+ return result, wrap(err) |
} |
commandDone := make(chan error) |
go func() { |
@@ -70,7 +70,7 @@ |
case <-time.After(params.Timeout): |
logger.Infof("killing the command due to timeout") |
- err = fmt.Errorf("command timed out") |
+ err = errors.Newf("command timed out") |
command.Kill() |
} |
// In either case, gather as much as we have from stdout and stderr |