mr-karan / doggo

:dog: Command-line DNS Client for Humans. Written in Golang
https://doggo.mrkaran.dev/
GNU General Public License v3.0
2.9k stars 100 forks source link

CLI exits with zero code even when there are errors and no responses #68

Closed roobre closed 2 months ago

roobre commented 1 year ago

Seems like there's a bug in doggo, where this condition:

https://github.com/mr-karan/doggo/blob/8492ccdc61f097da3a8e5dcb2080e77650af8d2d/cmd/doggo/cli.go#L166-L168

Never evaluates to true, because here:

https://github.com/mr-karan/doggo/blob/8492ccdc61f097da3a8e5dcb2080e77650af8d2d/cmd/doggo/cli.go#L158-L162

An empty response is always appended to responses, making len(responses) always greater than zero.

I can reproduce this by running doggo foo.local @0.0.0.0, and observing responses with a debugger:

DeepinScreenshot_select-area_20230323124738

mr-karan commented 2 months ago

Thanks for reporting. Will be fixed in the next release.

$ ./bin/doggo.bin foo.local @0.0.0.0
ERROR[2024-06-28T12:22:34+05:30] Error looking up DNS records                  error="read udp 127.0.0.1:58165->127.0.0.1:53: read: connection refused"

$ echo $?                           
9