diff --git a/command/agent/gated_writer.go b/command/agent/gated_writer.go index e9417c4b09..e1400e62a9 100644 --- a/command/agent/gated_writer.go +++ b/command/agent/gated_writer.go @@ -29,8 +29,8 @@ func (w *GatedWriter) Flush() { } func (w *GatedWriter) Write(p []byte) (n int, err error) { - w.lock.RLock() - defer w.lock.RUnlock() + w.lock.Lock() + defer w.lock.Unlock() if w.flush { return w.Writer.Write(p)