Skip to content

Commit 06a21db

Browse files
committed
handle disc.Run exit error
1 parent b48cacd commit 06a21db

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package main
1919

2020
import (
2121
"context"
22+
"fmt"
2223
"os"
2324
"strconv"
2425

@@ -31,7 +32,11 @@ func main() {
3132
parseArgs()
3233
mdnsDiscovery := &MDNSDiscovery{}
3334
disc := discovery.NewDiscoveryServer(mdnsDiscovery)
34-
disc.Run(os.Stdin, os.Stdout)
35+
if err := disc.Run(os.Stdin, os.Stdout); err != nil {
36+
fmt.Fprintf(os.Stderr, "Error: %s\n", err.Error())
37+
os.Exit(1)
38+
}
39+
3540
}
3641

3742
const mdnsServiceName = "_arduino._tcp.local."

0 commit comments

Comments
 (0)