1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/pkg/parsers/operatingsystem/operatingsystem_unix.go
allencloud a7f551359a make pkg/parsers support darwin and solaris
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-06-02 11:47:27 +08:00

25 lines
608 B
Go

// +build freebsd darwin
package operatingsystem
import (
"errors"
"os/exec"
)
// GetOperatingSystem gets the name of the current operating system.
func GetOperatingSystem() (string, error) {
cmd := exec.Command("uname", "-s")
osName, err := cmd.Output()
if err != nil {
return "", err
}
return string(osName), nil
}
// IsContainerized returns true if we are running inside a container.
// No-op on FreeBSD and Darwin, always returns false.
func IsContainerized() (bool, error) {
// TODO: Implement jail detection for freeBSD
return false, errors.New("Cannot detect if we are in container")
}