Skip to content

Commit 9a2178c

Browse files
committed
[skip changelog] Fix after botched rebase
1 parent 5b7fd85 commit 9a2178c

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

commands/instances.go

+3-23
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package commands
1717

1818
import (
1919
"context"
20-
"errors"
2120
"fmt"
2221
"io/ioutil"
2322
"net/url"
@@ -37,6 +36,7 @@ import (
3736
"github.com/arduino/arduino-cli/configuration"
3837
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
3938
paths "github.com/arduino/go-paths-helper"
39+
"github.com/pkg/errors"
4040
"github.com/sirupsen/logrus"
4141
"go.bug.st/downloader/v2"
4242
"google.golang.org/grpc/codes"
@@ -408,21 +408,11 @@ func UpdateLibrariesIndex(ctx context.Context, req *rpc.UpdateLibrariesIndexRequ
408408
}
409409

410410
// Reinitializes an existing instance
411-
initChan, status := Init(&rpc.InitRequest{Instance: &rpc.Instance{Id: req.Instance.Id}})
411+
status := Init(&rpc.InitRequest{Instance: &rpc.Instance{Id: req.Instance.Id}}, nil)
412412
if status != nil {
413413
return status.Err()
414414
}
415415

416-
// Handle responses
417-
for response := range initChan {
418-
if err := response.GetError(); err != nil {
419-
// We return right away without iterating all the errors, the chance
420-
// of failure in this case is slim but it would be great in the future
421-
// to handle errors when updating the libraries indexes much like we
422-
// do when initializing an instance.
423-
return fmt.Errorf("rescanning filesystem: %s", err)
424-
}
425-
}
426416
return nil
427417
}
428418

@@ -545,20 +535,10 @@ func UpdateIndex(ctx context.Context, req *rpc.UpdateIndexRequest, downloadCB Do
545535
}
546536

547537
// Reinitializes an existing instance
548-
initChan, status := Init(&rpc.InitRequest{Instance: &rpc.Instance{Id: req.Instance.Id}})
538+
status := Init(&rpc.InitRequest{Instance: &rpc.Instance{Id: req.Instance.Id}}, nil)
549539
if status != nil {
550540
return nil, status.Err()
551541
}
552-
// Handle responses
553-
for response := range initChan {
554-
if err := response.GetError(); err != nil {
555-
// We return right away without iterating all the errors, the chance
556-
// of failure in this case is slim but it would be great in the future
557-
// to handle errors when updating the platforms indexes much like we
558-
// do when initializing an instance.
559-
return nil, fmt.Errorf("rescanning filesystem: %s", err)
560-
}
561-
}
562542

563543
return &rpc.UpdateIndexResponse{}, nil
564544
}

0 commit comments

Comments
 (0)