Commit eb5f478e authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

communicator/ssh: Return error if non-zero exit status on Upload

parent 821d27a6
...@@ -137,15 +137,13 @@ func (c *comm) Upload(path string, input io.Reader) error { ...@@ -137,15 +137,13 @@ func (c *comm) Upload(path string, input io.Reader) error {
// our data and has completed. Or has errored. // our data and has completed. Or has errored.
err = session.Wait() err = session.Wait()
if err != nil { if err != nil {
exitErr, ok := err.(*ssh.ExitError) if exitErr, ok := err.(*ssh.ExitError); ok {
if !ok {
// This wasn't an exit error, so something fatal happened
return err
}
// Otherwise, we have an ExitErorr, meaning we can just read // Otherwise, we have an ExitErorr, meaning we can just read
// the exit status // the exit status
log.Printf("exit status: %d", exitErr.ExitStatus()) log.Printf("non-zero exit status: %d", exitErr.ExitStatus())
}
return err
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment