@@ -17,7 +17,6 @@ package commands
17
17
18
18
import (
19
19
"context"
20
- "errors"
21
20
"fmt"
22
21
"io/ioutil"
23
22
"net/url"
@@ -37,6 +36,7 @@ import (
37
36
"github.com/arduino/arduino-cli/configuration"
38
37
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
39
38
paths "github.com/arduino/go-paths-helper"
39
+ "github.com/pkg/errors"
40
40
"github.com/sirupsen/logrus"
41
41
"go.bug.st/downloader/v2"
42
42
"google.golang.org/grpc/codes"
@@ -408,21 +408,11 @@ func UpdateLibrariesIndex(ctx context.Context, req *rpc.UpdateLibrariesIndexRequ
408
408
}
409
409
410
410
// 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 )
412
412
if status != nil {
413
413
return status .Err ()
414
414
}
415
415
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
- }
426
416
return nil
427
417
}
428
418
@@ -545,20 +535,10 @@ func UpdateIndex(ctx context.Context, req *rpc.UpdateIndexRequest, downloadCB Do
545
535
}
546
536
547
537
// 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 )
549
539
if status != nil {
550
540
return nil , status .Err ()
551
541
}
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
- }
562
542
563
543
return & rpc.UpdateIndexResponse {}, nil
564
544
}
0 commit comments