mirror of
https://github.com/containers/podman.git
synced 2025-06-29 15:08:09 +08:00
Add support for machine events on Windows
Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
This commit is contained in:
@ -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 || 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
|
||||
}
|
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
|
||||
|
Reference in New Issue
Block a user