mirror of
https://github.com/gravitl/netmaker.git
synced 2024-11-15 06:05:27 +08:00
30 lines
711 B
Go
30 lines
711 B
Go
package ncutils
|
|
|
|
import (
|
|
"github.com/gravitl/netmaker/logger"
|
|
"os/exec"
|
|
"strings"
|
|
)
|
|
|
|
// RunCmd - runs a local command
|
|
func RunCmd(command string, printerr bool) (string, error) {
|
|
args := strings.Fields(command)
|
|
cmd := exec.Command(args[0], args[1:]...)
|
|
cmd.Wait()
|
|
out, err := cmd.CombinedOutput()
|
|
if err != nil && printerr {
|
|
logger.Log(0, "error running command:", command)
|
|
logger.Log(0, strings.TrimSuffix(string(out), "\n"))
|
|
}
|
|
return string(out), err
|
|
}
|
|
|
|
// RunCmdFormatted - run a command formatted for MacOS
|
|
func RunCmdFormatted(command string, printerr bool) (string, error) {
|
|
return "", nil
|
|
}
|
|
|
|
// GetEmbedded - if files required for MacOS, put here
|
|
func GetEmbedded() error {
|
|
return nil
|
|
}
|