We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e50f391 commit 4a84564Copy full SHA for 4a84564
arduino/discovery/discovery.go
@@ -37,6 +37,7 @@ type Discovery struct {
37
out io.ReadCloser
38
outJSON *json.Decoder
39
cmd *exec.Cmd
40
+ Timeout time.Duration
41
}
42
43
// BoardPort is a generic port descriptor
@@ -60,7 +61,7 @@ func NewFromCommandLine(args ...string) (*Discovery, error) {
60
61
if err != nil {
62
return nil, fmt.Errorf("creating discovery process: %s", err)
63
- disc := &Discovery{}
64
+ disc := &Discovery{Timeout: time.Second}
65
disc.cmd = cmd
66
return disc, nil
67
@@ -95,7 +96,7 @@ func (d *Discovery) List() ([]*BoardPort, error) {
95
96
go func() {
97
select {
98
case <-done:
- case <-time.After(5 * time.Second):
99
+ case <-time.After(d.Timeout):
100
timeout = true
101
d.Close()
102
0 commit comments