From 09405cdb38bd3709cec3efbb0aa525683a08f01d Mon Sep 17 00:00:00 2001 From: Lan Tian Date: Fri, 8 Sep 2023 18:22:31 -0700 Subject: [PATCH] frontend: also print whois client output on error --- frontend/whois.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/frontend/whois.go b/frontend/whois.go index 1bce5b7..d1e2b0e 100644 --- a/frontend/whois.go +++ b/frontend/whois.go @@ -25,13 +25,14 @@ func whois(s string) string { cmd := exec.Command(args[0], args[1:]...) output, err := cmd.CombinedOutput() - if err != nil { - return err.Error() - } if len(output) > 65535 { output = output[:65535] } - return string(output) + if err != nil { + return err.Error() + "\n" + string(output) + } else { + return string(output) + } } else { buf := make([]byte, 65536) @@ -50,7 +51,7 @@ func whois(s string) string { n, err := io.ReadFull(conn, buf) if err != nil && err != io.EOF && err != io.ErrUnexpectedEOF { - return err.Error() + return err.Error() + "\n" + string(buf[:n]) } return string(buf[:n]) }