aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman/machine
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-05-16 12:32:50 +0200
committerGitHub <noreply@github.com>2022-05-16 12:32:50 +0200
commitcedbbfa543651a13055a1fe093a4d0a2a28ccdfd (patch)
treeb3ba3112906a8234a0b27a2bad331c9cb5e66a6e /cmd/podman/machine
parenta87bba317e403c69b38c65958f2121d7e3f8a58e (diff)
parent4ae7161c4c775879b8ff3fbdaa5e93ef732cd5c5 (diff)
downloadpodman-cedbbfa543651a13055a1fe093a4d0a2a28ccdfd.tar.gz
podman-cedbbfa543651a13055a1fe093a4d0a2a28ccdfd.tar.bz2
podman-cedbbfa543651a13055a1fe093a4d0a2a28ccdfd.zip
Merge pull request #14247 from n1hility/machine-event-win-41
[v4.1] Cherry-pick windows machine events
Diffstat (limited to 'cmd/podman/machine')
-rw-r--r--cmd/podman/machine/machine.go2
-rw-r--r--cmd/podman/machine/machine_unix.go12
-rw-r--r--cmd/podman/machine/machine_windows.go11
3 files changed, 24 insertions, 1 deletions
diff --git a/cmd/podman/machine/machine.go b/cmd/podman/machine/machine.go
index 553f1ef7a..5a8a06b9d 100644
--- a/cmd/podman/machine/machine.go
+++ b/cmd/podman/machine/machine.go
@@ -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
diff --git a/cmd/podman/machine/machine_unix.go b/cmd/podman/machine/machine_unix.go
new file mode 100644
index 000000000..b56d081ec
--- /dev/null
+++ b/cmd/podman/machine/machine_unix.go
@@ -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
+}
diff --git a/cmd/podman/machine/machine_windows.go b/cmd/podman/machine/machine_windows.go
new file mode 100644
index 000000000..ffd5d8827
--- /dev/null
+++ b/cmd/podman/machine/machine_windows.go
@@ -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")
+}