From 42658b7ed2fd2fcab402a5433b8abdf5e6f748b6 Mon Sep 17 00:00:00 2001 From: Drew Bailey <2614075+drewbailey@users.noreply.github.com> Date: Thu, 11 Jun 2020 16:19:54 -0400 Subject: [PATCH] only report tasklogger is running if both stdout and stderr are still running --- client/logmon/logmon.go | 10 +++------- client/logmon/logmon_test.go | 1 - 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/client/logmon/logmon.go b/client/logmon/logmon.go index f230b3b080a..dfc31e2b4c4 100644 --- a/client/logmon/logmon.go +++ b/client/logmon/logmon.go @@ -110,14 +110,10 @@ type TaskLogger struct { // IsRunning will return true as long as one rotator wrapper is still running func (tl *TaskLogger) IsRunning() bool { - if tl.lro != nil && tl.lro.isRunning() { - return true - } - if tl.lre != nil && tl.lre.isRunning() { - return true - } + lroRunning := tl.lro != nil && tl.lro.isRunning() + lreRunning := tl.lre != nil && tl.lre.isRunning() - return false + return lroRunning && lreRunning } func (tl *TaskLogger) Close() { diff --git a/client/logmon/logmon_test.go b/client/logmon/logmon_test.go index 8f0fa8f1c7c..8ad7dffe40b 100644 --- a/client/logmon/logmon_test.go +++ b/client/logmon/logmon_test.go @@ -235,7 +235,6 @@ func TestLogmon_Start_restart(t *testing.T) { require.True(impl.tl.IsRunning()) // Close stdout and assert that logmon no longer writes to the file - require.NoError(stdout.Close()) require.NoError(stderr.Close()) testutil.WaitForResult(func() (bool, error) {