2021-11-17 09:10:11 +08:00
|
|
|
package ncutils
|
|
|
|
|
|
|
|
import (
|
2021-11-18 13:01:05 +08:00
|
|
|
"fmt"
|
2021-11-17 09:10:11 +08:00
|
|
|
"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 {
|
2022-01-02 23:30:07 +08:00
|
|
|
Log(fmt.Sprintf("error running command: %s", command))
|
|
|
|
Log(strings.TrimSuffix(string(out), "\n"))
|
2021-11-17 09:10:11 +08:00
|
|
|
}
|
|
|
|
return string(out), err
|
|
|
|
}
|
2021-11-18 10:57:27 +08:00
|
|
|
|
2021-12-13 07:04:41 +08:00
|
|
|
// RunCmdFormatted - does nothing for linux
|
2021-11-18 13:01:05 +08:00
|
|
|
func RunCmdFormatted(command string, printerr bool) (string, error) {
|
|
|
|
return "", nil
|
|
|
|
}
|
|
|
|
|
2021-12-13 07:04:41 +08:00
|
|
|
// GetEmbedded - if files required for linux, put here
|
|
|
|
func GetEmbedded() error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2022-01-25 20:31:50 +08:00
|
|
|
|