workaround for ETXTBSY race condition
This commit is contained in:
parent
50ff4ba0ac
commit
d62966dd74
@ -23,6 +23,7 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -321,8 +322,21 @@ func (a *Agent) CmdV2(c *CmdOptions) CmdStatus {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Run and wait for Cmd to return, discard Status
|
// workaround for https://github.com/golang/go/issues/22315
|
||||||
envCmd.Start()
|
for i := 0; i < 5; i++ {
|
||||||
|
<-envCmd.Start()
|
||||||
|
|
||||||
|
<-doneChan
|
||||||
|
|
||||||
|
status := envCmd.Status()
|
||||||
|
|
||||||
|
if errors.Is(status.Error, syscall.ETXTBSY) {
|
||||||
|
a.Logger.Errorln("CmdV2 syscall.ETXTBSY, retrying...")
|
||||||
|
time.Sleep(500 * time.Millisecond)
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
select {
|
select {
|
||||||
|
Loading…
Reference in New Issue
Block a user