Skip to content

Commit

Permalink
use stricter mutex policy to prevent installed.json corruption
Browse files Browse the repository at this point in the history
  • Loading branch information
umbynos committed Apr 27, 2021
1 parent 76ab40f commit c91b407
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ func (t *Tools) GetLocation(command string) (string, error) {

// writeMap() writes installed map to the json file "installed.json"
func (t *Tools) writeMap() error {
t.mutex.RLock()
t.mutex.Lock()
b, err := json.Marshal(t.installed)
t.mutex.RUnlock()
defer t.mutex.Unlock()
if err != nil {
return err
}
Expand Down

0 comments on commit c91b407

Please sign in to comment.