netmaker/netclient/ncutils/netclientutils_darwin.go

31 lines
711 B
Go
Raw Normal View History

2021-11-17 09:10:11 +08:00
package ncutils
import (
2022-03-21 19:30:56 +08:00
"github.com/gravitl/netmaker/logger"
2021-11-17 09:10:11 +08:00
"os/exec"
"strings"
)
// RunCmd - runs a local command
func RunCmd(command string, printerr bool) (string, error) {
2021-11-18 10:57:27 +08:00
args := strings.Fields(command)
cmd := exec.Command(args[0], args[1:]...)
cmd.Wait()
out, err := cmd.CombinedOutput()
if err != nil && printerr {
2022-03-21 19:30:56 +08:00
logger.Log(0, "error running command:", command)
logger.Log(0, strings.TrimSuffix(string(out), "\n"))
2021-11-18 10:57:27 +08:00
}
return string(out), err
2021-11-17 09:10:11 +08:00
}
2021-11-17 23:21:35 +08:00
// RunCmdFormatted - run a command formatted for MacOS
2021-11-18 13:01:05 +08:00
func RunCmdFormatted(command string, printerr bool) (string, error) {
return "", nil
}
// GetEmbedded - if files required for MacOS, put here
func GetEmbedded() error {
return nil
}