Skip to content

Commit aeb0472

Browse files
committed
Restored timeout flag in 'board list'
1 parent c94cd2a commit aeb0472

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

cli/board/list.go

+8-6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"fmt"
2323
"os"
2424
"sort"
25+
"time"
2526

2627
"github.com/arduino/arduino-cli/cli"
2728
"github.com/arduino/arduino-cli/commands/board"
@@ -41,7 +42,7 @@ func initListCommand() *cobra.Command {
4142
Run: runListCommand,
4243
}
4344

44-
listCommand.Flags().StringVar(&listFlags.timeout, "timeout", "1s",
45+
listCommand.Flags().StringVar(&listFlags.timeout, "timeout", "0s",
4546
"The timeout of the search of connected devices, try to increase it if your board is not found (e.g. to 10s).")
4647
return listCommand
4748
}
@@ -54,11 +55,12 @@ var listFlags struct {
5455
func runListCommand(cmd *cobra.Command, args []string) {
5556
instance := cli.CreateInstance()
5657

57-
// timeout, err := time.ParseDuration(listFlags.timeout)
58-
// if err != nil {
59-
// formatter.PrintError(err, "Invalid timeout.")
60-
// os.Exit(cli.ErrBadArgument)
61-
// }
58+
if timeout, err := time.ParseDuration(listFlags.timeout); err != nil {
59+
formatter.PrintError(err, "Invalid timeout.")
60+
os.Exit(cli.ErrBadArgument)
61+
} else {
62+
time.Sleep(timeout)
63+
}
6264

6365
resp, err := board.BoardList(context.Background(), &rpc.BoardListReq{Instance: instance})
6466
if err != nil {

0 commit comments

Comments
 (0)