From 130ee60b5815ee23f7a1962229af3f8f8e2409e1 Mon Sep 17 00:00:00 2001 From: Sven Nierlein Date: Thu, 21 Mar 2024 17:09:15 +0100 Subject: [PATCH] silence "Unsolicited response received" again --- Changes | 1 + pkg/checknscweb/check.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index 584e5c8..c36a4de 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,7 @@ This file documents the revision history for check_nsc_web next: - minimum go version is now 1.22 + - silence "Unsolicited response received" messages 0.7.1 Wed Mar 13 20:30:41 CET 2024 - remove url parameters from error output diff --git a/pkg/checknscweb/check.go b/pkg/checknscweb/check.go index 5a2d70c..12f6201 100644 --- a/pkg/checknscweb/check.go +++ b/pkg/checknscweb/check.go @@ -225,8 +225,8 @@ func Check(ctx context.Context, output io.Writer, osArgs []string) int { return 3 } - defer hClient.CloseIdleConnections() + log.SetOutput(io.Discard) // avoid "Unsolicited response received on idle HTTP channel starting with" messages req, err := buildRequest(ctx, output, queryURL.String(), flags) if err != nil { fmt.Fprintf(output, "UNKNOWN - %s", err.Error()) @@ -251,6 +251,7 @@ func Check(ctx context.Context, output io.Writer, osArgs []string) int { return errorExit } + hClient.CloseIdleConnections() if flags.Verbose { dumpres, err2 := httputil.DumpResponse(res, true) @@ -261,7 +262,6 @@ func Check(ctx context.Context, output io.Writer, osArgs []string) int { fmt.Fprintf(output, "<<<<<