From 4b2b6a57a1b00b38745817ba8bc60f6ba04c42ce Mon Sep 17 00:00:00 2001 From: Ingo Oppermann Date: Wed, 24 May 2023 16:27:55 +0200 Subject: [PATCH] Fix calling Wait after process has been read --- process/process.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/process/process.go b/process/process.go index 32b28ae2..095f9d5d 100644 --- a/process/process.go +++ b/process/process.go @@ -504,9 +504,6 @@ func (p *process) start() error { // Start the reader go p.reader() - // Wait for the process to finish - go p.waiter() - // Start the stale timeout if enabled if p.stale.timeout != 0 { var ctx context.Context @@ -750,15 +747,18 @@ func (p *process) reader() { p.stale.lock.Unlock() } } + + if err := scanner.Err(); err != nil { + p.logger.Debug().WithError(err).Log("") + } + + // Wait for the process to finish + p.waiter() } // waiter waits for the process to finish. If enabled, the process will // be scheduled for a restart. func (p *process) waiter() { - if p.getState() == stateFinishing { - p.stop(false) - } - if err := p.cmd.Wait(); err != nil { // The process exited abnormally, i.e. the return code is non-zero or a signal // has been raised.