From 62cfa9983df0492942ae55afaf25316e53af62a5 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 29 Jun 2013 13:35:24 -0700 Subject: [PATCH] packer/plugin: Assume any listen error is a port collision [GH-58] --- CHANGELOG.md | 2 ++ packer/plugin/plugin.go | 11 ++--------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9b39c439..045836473 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ IMPROVEMENTS: BUG FIXES: +* core: Plugin servers consider a port in use if there is any + error listening to it. This fixes I18n issues and Windows. [GH-58] * amazon-ebs: Sleep between checking instance state to avoid RequestLimitExceeded [GH-50] * vagrant: Rename VirtualBox ovf to "box.ovf" [GH-64] diff --git a/packer/plugin/plugin.go b/packer/plugin/plugin.go index c34b564a4..5566fdcaf 100644 --- a/packer/plugin/plugin.go +++ b/packer/plugin/plugin.go @@ -19,7 +19,6 @@ import ( "os/signal" "runtime" "strconv" - "strings" ) const MagicCookieKey = "PACKER_PLUGIN_MAGIC_COOKIE" @@ -59,14 +58,8 @@ func serve(server *rpc.Server) (err error) { address = fmt.Sprintf("127.0.0.1:%d", port) listener, err = net.Listen("tcp", address) if err != nil { - if !strings.Contains(err.Error(), "address already in use") { - // Not an address already in use error, return. - return - } else { - // Address is in use, just try another - err = nil - continue - } + err = nil + continue } break