logmon: Workaround golang/go#29119
There's a bug in go1.11 that causes some io operations on windows to return incorrect errors for some cases when Stat-ing files. To avoid upgrading to go1.12 in a point release, here we loosen up the cases where we will attempt to create fifos, and add some logging of underlying stat errors to help with debugging.
This commit is contained in:
parent
dd6f55f33f
commit
1bcbbbfbe6
|
@ -204,7 +204,8 @@ func newLogRotatorWrapper(path string, logger hclog.Logger, rotator *logging.Fil
|
|||
var openFn func() (io.ReadCloser, error)
|
||||
var err error
|
||||
|
||||
if _, ferr := os.Stat(path); os.IsNotExist(ferr) {
|
||||
_, serr := os.Stat(path)
|
||||
if serr != nil {
|
||||
openFn, err = fifo.CreateAndRead(path)
|
||||
} else {
|
||||
openFn = func() (io.ReadCloser, error) {
|
||||
|
@ -213,6 +214,7 @@ func newLogRotatorWrapper(path string, logger hclog.Logger, rotator *logging.Fil
|
|||
}
|
||||
|
||||
if err != nil {
|
||||
logger.Error("Failed to create FIFO", "stat_error", serr, "create_err", err)
|
||||
return nil, fmt.Errorf("failed to create fifo for extracting logs: %v", err)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue