Skip to content

Commit

Permalink
fix concurrent map write
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Medeiros committed Aug 5, 2020
1 parent d94351e commit 24c7662
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/task/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func sudo(ui ui.UI, s ui.Spinner, sg ui.SpinnerGroup) func(string) func() error
func Run(ctx context.Context, ui ui.UI, p *project.Project, name string, fun func([]string) error) error {
bins := []string{}
envs := map[string]string{}
envsMu := &sync.Mutex{}
wg := &sync.WaitGroup{}
wgs := make(map[string]*sync.WaitGroup)
errs := make(chan error)
Expand Down Expand Up @@ -75,7 +76,9 @@ func Run(ctx context.Context, ui ui.UI, p *project.Project, name string, fun fun
e, b := te.Env(ctx, p)
bins = append(bins, b...)
for k, v := range e {
envsMu.Lock()
envs[k] = v
envsMu.Unlock()
}
if !done {
s := sg.NewSpinner(te.Header())
Expand Down

0 comments on commit 24c7662

Please sign in to comment.