swap semaquire and wg.Add to avoid a deadlock

This commit is contained in:
Adrien Delorme 2019-05-03 07:46:26 +02:00
parent 263f318e82
commit d40d3eca88
1 changed files with 2 additions and 2 deletions

View File

@ -180,13 +180,13 @@ func (c *BuildCommand) Run(args []string) int {
b := builds[i]
name := b.Name()
ui := buildUis[name]
// Increment the waitgroup so we wait for this item to finish properly
wg.Add(1)
if err := limitParallel.Acquire(buildCtx, 1); err != nil {
ui.Error(fmt.Sprintf("Build '%s' failed to acquire semaphore: %s", name, err))
errors[name] = err
break
}
// Increment the waitgroup so we wait for this item to finish properly
wg.Add(1)
// Run the build in a goroutine
go func() {