mirror of https://github.com/containers/podman.git
Merge pull request #14206 from n1hility/win-machine-events
Add support for machine events on Windows
This commit is contained in:
commit
9cf38a0afb
|
@ -115,7 +115,7 @@ func resolveEventSock() ([]string, error) {
|
||||||
return err
|
return err
|
||||||
case info.IsDir():
|
case info.IsDir():
|
||||||
return nil
|
return nil
|
||||||
case info.Type() != os.ModeSocket:
|
case !isUnixSocket(info):
|
||||||
return nil
|
return nil
|
||||||
case !re.MatchString(info.Name()):
|
case !re.MatchString(info.Name()):
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
//go:build linux || ignore || aix || ignore || android || ignore || darwin || ignore || freebsd || ignore || hurd || ignore || illumos || ignore || ios || ignore || netbsd || ignore || openbsd || ignore || solaris
|
||||||
|
// +build linux ignore aix ignore android ignore darwin ignore freebsd ignore hurd ignore illumos ignore ios ignore netbsd ignore openbsd ignore solaris
|
||||||
|
|
||||||
|
package machine
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
func isUnixSocket(file os.DirEntry) bool {
|
||||||
|
return file.Type()&os.ModeSocket != 0
|
||||||
|
}
|
|
@ -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
|
package util
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/containers/storage/pkg/homedir"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -34,7 +37,12 @@ func GetRootlessPauseProcessPidPathGivenDir(unused string) (string, error) {
|
||||||
|
|
||||||
// GetRuntimeDir returns the runtime directory
|
// GetRuntimeDir returns the runtime directory
|
||||||
func GetRuntimeDir() (string, error) {
|
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
|
// GetRootlessConfigHomeDir returns the config home directory when running as non root
|
||||||
|
|
Loading…
Reference in New Issue