From 81edbb4173c1b72d9dcbbbebc25d66f046e74eec Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 5 Sep 2013 19:55:09 -0700 Subject: [PATCH] communicator/ssh: detect if SCP exited with failure [GH-386] --- CHANGELOG.md | 1 + communicator/ssh/communicator.go | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a7ec358e..f56ea00fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ IMPROVEMENTS: BUG FIXES: +* core: Detect if SCP is not enabled on the other side. [GH-386] * builder/amazon/all: When copying AMI to multiple regions, copy the metadata (tags and attributes) as well. [GH-388] * builder/amazon/all: Fix panic case where eventually consistent diff --git a/communicator/ssh/communicator.go b/communicator/ssh/communicator.go index 9279ee132..96de20de0 100644 --- a/communicator/ssh/communicator.go +++ b/communicator/ssh/communicator.go @@ -290,9 +290,11 @@ func (c *comm) scpSession(scpCommand string, f func(io.Writer, *bufio.Reader) er return err } - // Call our callback that executes in the context of SCP + // Call our callback that executes in the context of SCP. We ignore + // EOF errors if they occur because it usually means that SCP prematurely + // ended on the other side. log.Println("Started SCP session, beginning transfers...") - if err := f(stdinW, stdoutR); err != nil { + if err := f(stdinW, stdoutR); err != nil && err != io.EOF { return err }