Fix calling Wait after process has been read
This commit is contained in:
parent
8c3b570ecc
commit
4b2b6a57a1
1 changed files with 7 additions and 7 deletions
|
|
@ -504,9 +504,6 @@ func (p *process) start() error {
|
||||||
// Start the reader
|
// Start the reader
|
||||||
go p.reader()
|
go p.reader()
|
||||||
|
|
||||||
// Wait for the process to finish
|
|
||||||
go p.waiter()
|
|
||||||
|
|
||||||
// Start the stale timeout if enabled
|
// Start the stale timeout if enabled
|
||||||
if p.stale.timeout != 0 {
|
if p.stale.timeout != 0 {
|
||||||
var ctx context.Context
|
var ctx context.Context
|
||||||
|
|
@ -750,15 +747,18 @@ func (p *process) reader() {
|
||||||
p.stale.lock.Unlock()
|
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
|
// waiter waits for the process to finish. If enabled, the process will
|
||||||
// be scheduled for a restart.
|
// be scheduled for a restart.
|
||||||
func (p *process) waiter() {
|
func (p *process) waiter() {
|
||||||
if p.getState() == stateFinishing {
|
|
||||||
p.stop(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := p.cmd.Wait(); err != nil {
|
if err := p.cmd.Wait(); err != nil {
|
||||||
// The process exited abnormally, i.e. the return code is non-zero or a signal
|
// The process exited abnormally, i.e. the return code is non-zero or a signal
|
||||||
// has been raised.
|
// has been raised.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue