mirror of
https://github.com/containers/podman.git
synced 2025-10-26 02:35:43 +08:00
Merge pull request #23526 from baude/windowsgvisorpidnoterror
Ignore ERROR_SHARING_VIOLATION error on windows
This commit is contained in:
@ -27,5 +27,5 @@ func CleanupGVProxy(f define.VMFile) error {
|
|||||||
if err := waitOnProcess(proxyPid); err != nil {
|
if err := waitOnProcess(proxyPid); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return f.Delete()
|
return removeGVProxyPIDFile(f)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/containers/podman/v5/pkg/machine/define"
|
||||||
psutil "github.com/shirou/gopsutil/v3/process"
|
psutil "github.com/shirou/gopsutil/v3/process"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
@ -72,3 +73,9 @@ func waitOnProcess(processID int) error {
|
|||||||
}
|
}
|
||||||
return backoffForProcess(p)
|
return backoffForProcess(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// removeGVProxyPIDFile is just a wrapper to vmfile delete so we handle differently
|
||||||
|
// on windows
|
||||||
|
func removeGVProxyPIDFile(f define.VMFile) error {
|
||||||
|
return f.Delete()
|
||||||
|
}
|
||||||
|
|||||||
@ -1,11 +1,14 @@
|
|||||||
package machine
|
package machine
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/containers/podman/v5/pkg/machine/define"
|
||||||
"github.com/containers/winquit/pkg/winquit"
|
"github.com/containers/winquit/pkg/winquit"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
"golang.org/x/sys/windows"
|
||||||
)
|
)
|
||||||
|
|
||||||
func waitOnProcess(processID int) error {
|
func waitOnProcess(processID int) error {
|
||||||
@ -44,3 +47,13 @@ func waitOnProcess(processID int) error {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// removeGVProxyPIDFile special wrapper for deleting the GVProxyPIDFile on windows in case
|
||||||
|
// the file has an open handle which we will ignore. unix does not have this problem
|
||||||
|
func removeGVProxyPIDFile(f define.VMFile) error {
|
||||||
|
err := f.Delete()
|
||||||
|
if err != nil && !errors.Is(err, windows.ERROR_SHARING_VIOLATION) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user