mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-09-09 00:57:53 +00:00
Merge pull request #14247 from n1hility/machine-event-win-41
[v4.1] Cherry-pick windows machine events
This commit is contained in:
commit
cedbbfa543
4 changed files with 33 additions and 2 deletions
|
|
@ -115,7 +115,7 @@ func resolveEventSock() ([]string, error) {
|
|||
return err
|
||||
case info.IsDir():
|
||||
return nil
|
||||
case info.Type() != os.ModeSocket:
|
||||
case !isUnixSocket(info):
|
||||
return nil
|
||||
case !re.MatchString(info.Name()):
|
||||
return nil
|
||||
|
|
|
|||
12
cmd/podman/machine/machine_unix.go
Normal file
12
cmd/podman/machine/machine_unix.go
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
//go:build linux || aix || android || darwin || dragonfly || freebsd || hurd || illumos || ios || netbsd || openbsd || solaris
|
||||
// +build linux aix android darwin dragonfly freebsd hurd illumos ios netbsd openbsd solaris
|
||||
|
||||
package machine
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
func isUnixSocket(file os.DirEntry) bool {
|
||||
return file.Type()&os.ModeSocket != 0
|
||||
}
|
||||
11
cmd/podman/machine/machine_windows.go
Normal file
11
cmd/podman/machine/machine_windows.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
package machine
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func isUnixSocket(file os.DirEntry) bool {
|
||||
// Assume a socket on Windows, since sock mode is not supported yet https://github.com/golang/go/issues/33357
|
||||
return !file.Type().IsDir() && strings.HasSuffix(file.Name(), ".sock")
|
||||
}
|
||||
|
|
@ -4,6 +4,9 @@
|
|||
package util
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/containers/storage/pkg/homedir"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
|
@ -34,7 +37,12 @@ func GetRootlessPauseProcessPidPathGivenDir(unused string) (string, error) {
|
|||
|
||||
// GetRuntimeDir returns the runtime directory
|
||||
func GetRuntimeDir() (string, error) {
|
||||
return "", errors.New("this function is not implemented for windows")
|
||||
data, err := homedir.GetDataHome()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
runtimeDir := filepath.Join(data, "containers", "podman")
|
||||
return runtimeDir, nil
|
||||
}
|
||||
|
||||
// GetRootlessConfigHomeDir returns the config home directory when running as non root
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue