Skip to content

Commit 20b8afa

Browse files
author
Massimiliano Pippi
authored
[skip changelog] sync api query (arduino#383)
1 parent 549b0fb commit 20b8afa

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: commands/board/list.go

+5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"fmt"
2323
"io/ioutil"
2424
"net/http"
25+
"sync"
2526

2627
"github.com/arduino/arduino-cli/cli/globals"
2728
"github.com/arduino/arduino-cli/commands"
@@ -33,6 +34,7 @@ import (
3334
var (
3435
// ErrNotFound is returned when the API returns 404
3536
ErrNotFound = errors.New("board not found")
37+
m sync.Mutex
3638
)
3739

3840
func apiByVidPid(url string) ([]*rpc.BoardListItem, error) {
@@ -78,6 +80,9 @@ func apiByVidPid(url string) ([]*rpc.BoardListItem, error) {
7880

7981
// List FIXMEDOC
8082
func List(instanceID int32) ([]*rpc.DetectedPort, error) {
83+
m.Lock()
84+
defer m.Unlock()
85+
8186
pm := commands.GetPackageManager(instanceID)
8287
if pm == nil {
8388
return nil, errors.New("invalid instance")

0 commit comments

Comments
 (0)