File tree Expand file tree Collapse file tree 3 files changed +27
-4
lines changed Expand file tree Collapse file tree 3 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -42,8 +42,16 @@ func initUpdateIndexCommand() *cobra.Command {
42
42
}
43
43
44
44
func runUpdateIndexCommand (cmd * cobra.Command , args []string ) {
45
- instance := instance .CreateAndInit ()
46
45
logrus .Info ("Executing `arduino core update-index`" )
46
+ // We don't initialize any CoreInstance when updating indexes since we don't need to.
47
+ // Also meaningless errors might be returned when calling this command with --additional-urls
48
+ // since the CLI would be searching for a corresponding file for the additional urls set
49
+ // as argument but none would be obviously found.
50
+ instance , status := instance .Create ()
51
+ if status != nil {
52
+ feedback .Errorf ("Error creating instance: %v" , status )
53
+ os .Exit (errorcodes .ErrGeneric )
54
+ }
47
55
48
56
_ , err := commands .UpdateIndex (context .Background (), & rpc.UpdateIndexRequest {
49
57
Instance : instance ,
Original file line number Diff line number Diff line change @@ -36,7 +36,15 @@ func initUpdateIndexCommand() *cobra.Command {
36
36
Example : " " + os .Args [0 ] + " lib update-index" ,
37
37
Args : cobra .NoArgs ,
38
38
Run : func (cmd * cobra.Command , args []string ) {
39
- instance := instance .CreateAndInit ()
39
+ // We don't initialize any CoreInstance when updating indexes since we don't need to.
40
+ // Also meaningless errors might be returned when calling this command with --additional-urls
41
+ // since the CLI would be searching for a corresponding file for the additional urls set
42
+ // as argument but none would be obviously found.
43
+ instance , status := instance .Create ()
44
+ if status != nil {
45
+ feedback .Errorf ("Error creating instance: %v" , status )
46
+ os .Exit (errorcodes .ErrGeneric )
47
+ }
40
48
err := commands .UpdateLibrariesIndex (context .Background (), & rpc.UpdateLibrariesIndexRequest {
41
49
Instance : instance ,
42
50
}, output .ProgressBar ())
Original file line number Diff line number Diff line change @@ -49,8 +49,15 @@ var updateFlags struct {
49
49
}
50
50
51
51
func runUpdateCommand (cmd * cobra.Command , args []string ) {
52
- instance := instance .CreateAndInit ()
53
-
52
+ // We don't initialize any CoreInstance when updating indexes since we don't need to.
53
+ // Also meaningless errors might be returned when calling this command with --additional-urls
54
+ // since the CLI would be searching for a corresponding file for the additional urls set
55
+ // as argument but none would be obviously found.
56
+ instance , status := instance .Create ()
57
+ if status != nil {
58
+ feedback .Errorf ("Error creating instance: %v" , status )
59
+ os .Exit (errorcodes .ErrGeneric )
60
+ }
54
61
logrus .Info ("Executing `arduino update`" )
55
62
56
63
err := commands .UpdateCoreLibrariesIndex (context .Background (), & rpc.UpdateCoreLibrariesIndexRequest {
You can’t perform that action at this time.
0 commit comments