Skip to content

Commit

Permalink
In compile command try to release the package manager lock ASAP (#2741
Browse files Browse the repository at this point in the history
)

* In `compile` command try to release the package manager lock ASAP

* Applied suggestion from code review
  • Loading branch information
cmaglie authored Nov 21, 2024
1 parent c3d05d6 commit ca4a4ec
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions commands/service_compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"io"
"sort"
"strings"
"sync"
"time"

"github.com/arduino/arduino-cli/commands/cmderrors"
Expand Down Expand Up @@ -81,6 +82,7 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
if err != nil {
return err
}
release = sync.OnceFunc(release)
defer release()

if pme.Dirty() {
Expand Down Expand Up @@ -358,6 +360,10 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
targetBoard.String(), "'build.board'", sketchBuilder.GetBuildProperties().Get("build.board")) + "\n"))
}

// Release package manager
release()

// Perform the actual build
if err := sketchBuilder.Build(); err != nil {
return &cmderrors.CompileFailedError{Message: err.Error()}
}
Expand Down

0 comments on commit ca4a4ec

Please sign in to comment.