Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-cli
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Operations
Operations
Metrics
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-cli
Commits
d684dec1
Commit
d684dec1
authored
Feb 17, 2022
by
Silvano Cerza
Committed by
Silvano Cerza
Feb 23, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
board list now returns partial results in case of errors (#1668)
parent
10107d24
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
cli/board/list.go
cli/board/list.go
+0
-1
commands/board/list.go
commands/board/list.go
+6
-5
No files found.
cli/board/list.go
View file @
d684dec1
...
@@ -70,7 +70,6 @@ func runListCommand(cmd *cobra.Command, args []string) {
...
@@ -70,7 +70,6 @@ func runListCommand(cmd *cobra.Command, args []string) {
})
})
if
err
!=
nil
{
if
err
!=
nil
{
feedback
.
Errorf
(
tr
(
"Error detecting boards: %v"
),
err
)
feedback
.
Errorf
(
tr
(
"Error detecting boards: %v"
),
err
)
os
.
Exit
(
errorcodes
.
ErrNetwork
)
}
}
feedback
.
PrintResult
(
result
{
ports
})
feedback
.
PrintResult
(
result
{
ports
})
}
}
...
...
commands/board/list.go
View file @
d684dec1
...
@@ -174,7 +174,9 @@ func identify(pm *packagemanager.PackageManager, port *discovery.Port) ([]*rpc.B
...
@@ -174,7 +174,9 @@ func identify(pm *packagemanager.PackageManager, port *discovery.Port) ([]*rpc.B
return
boards
,
nil
return
boards
,
nil
}
}
// List FIXMEDOC
// List returns a list of boards found by the loaded discoveries.
// In case of errors partial results from discoveries that didn't fail
// are returned.
func
List
(
req
*
rpc
.
BoardListRequest
)
(
r
[]
*
rpc
.
DetectedPort
,
e
error
)
{
func
List
(
req
*
rpc
.
BoardListRequest
)
(
r
[]
*
rpc
.
DetectedPort
,
e
error
)
{
tags
:=
map
[
string
]
string
{}
tags
:=
map
[
string
]
string
{}
// Use defer func() to evaluate tags map when function returns
// Use defer func() to evaluate tags map when function returns
...
@@ -208,9 +210,6 @@ func List(req *rpc.BoardListRequest) (r []*rpc.DetectedPort, e error) {
...
@@ -208,9 +210,6 @@ func List(req *rpc.BoardListRequest) (r []*rpc.DetectedPort, e error) {
retVal
:=
[]
*
rpc
.
DetectedPort
{}
retVal
:=
[]
*
rpc
.
DetectedPort
{}
ports
,
errs
:=
pm
.
DiscoveryManager
()
.
List
()
ports
,
errs
:=
pm
.
DiscoveryManager
()
.
List
()
if
len
(
errs
)
>
0
{
return
nil
,
&
arduino
.
UnavailableError
{
Message
:
tr
(
"Error getting board list"
),
Cause
:
fmt
.
Errorf
(
"%v"
,
errs
)}
}
for
_
,
port
:=
range
ports
{
for
_
,
port
:=
range
ports
{
boards
,
err
:=
identify
(
pm
,
port
)
boards
,
err
:=
identify
(
pm
,
port
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -225,7 +224,9 @@ func List(req *rpc.BoardListRequest) (r []*rpc.DetectedPort, e error) {
...
@@ -225,7 +224,9 @@ func List(req *rpc.BoardListRequest) (r []*rpc.DetectedPort, e error) {
}
}
retVal
=
append
(
retVal
,
b
)
retVal
=
append
(
retVal
,
b
)
}
}
if
len
(
errs
)
>
0
{
return
retVal
,
&
arduino
.
UnavailableError
{
Message
:
tr
(
"Error getting board list"
),
Cause
:
fmt
.
Errorf
(
"%v"
,
errs
)}
}
return
retVal
,
nil
return
retVal
,
nil
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment