Commit 81595258 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

command/build: Lexical scoping bug to get the right build

parent dd4fb1d6
......@@ -128,16 +128,16 @@ func (c Command) Run(env packer.Environment, args []string) int {
var wg sync.WaitGroup
artifacts := make(map[string]packer.Artifact)
for _, b := range builds {
log.Printf("Starting build run: %s", b.Name())
// Increment the waitgroup so we wait for this item to finish properly
wg.Add(1)
// Run the build in a goroutine
go func() {
go func(b packer.Build) {
defer wg.Done()
log.Printf("Starting build run: %s", b.Name())
artifacts[b.Name()] = b.Run(buildUis[b.Name()])
}()
}(b)
}
// Handle signals
......
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