A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/arduino/arduino-create-agent/commit/fb06ef3746e769925505948b0a8c77080d6b8b92 below:

Insert lock while reading from the installed map (#987) · arduino/arduino-create-agent@fb06ef3 · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+8

-1

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+8

-1

lines changed Original file line number Diff line number Diff line change

@@ -188,7 +188,7 @@ func (t *Tools) Install(ctx context.Context, payload *tools.ToolPayload) (*tools

188 188

key := correctTool.Name + "-" + correctTool.Version

189 189

// Check if it already exists

190 190

if t.behaviour == "keep" && pathExists(t.folder) {

191 -

location, ok := t.installed[key]

191 +

location, ok := t.getInstalledValue(key)

192 192

if ok && pathExists(location) {

193 193

// overwrite the default tool with this one

194 194

err := t.writeInstalled(path)

@@ -336,6 +336,13 @@ func (t *Tools) SetBehaviour(behaviour string) {

336 336

t.behaviour = behaviour

337 337

}

338 338 339 +

func (t *Tools) getInstalledValue(key string) (string, bool) {

340 +

t.mutex.RLock()

341 +

defer t.mutex.RUnlock()

342 +

location, ok := t.installed[key]

343 +

return location, ok

344 +

}

345 + 339 346

func pathExists(path string) bool {

340 347

_, err := os.Stat(path)

341 348

if err == nil {

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4