|
@@ -2,6 +2,7 @@ package ncutils
|
|
|
|
|
|
import (
|
|
import (
|
|
"context"
|
|
"context"
|
|
|
|
+ "fmt"
|
|
"log"
|
|
"log"
|
|
"os/exec"
|
|
"os/exec"
|
|
"strings"
|
|
"strings"
|
|
@@ -11,7 +12,16 @@ import (
|
|
|
|
|
|
// RunCmdFormatted - run a command formatted for freebsd
|
|
// RunCmdFormatted - run a command formatted for freebsd
|
|
func RunCmdFormatted(command string, printerr bool) (string, error) {
|
|
func RunCmdFormatted(command string, printerr bool) (string, error) {
|
|
- return "", nil
|
|
|
|
|
|
+
|
|
|
|
+ args := strings.Fields(command)
|
|
|
|
+ cmd := exec.Command(args[0], args[1:]...)
|
|
|
|
+ cmd.Wait()
|
|
|
|
+ out, err := cmd.CombinedOutput()
|
|
|
|
+ if err != nil && printerr {
|
|
|
|
+ Log(fmt.Sprintf("error running command: %s", command))
|
|
|
|
+ Log(strings.TrimSuffix(string(out), "\n"))
|
|
|
|
+ }
|
|
|
|
+ return string(out), err
|
|
}
|
|
}
|
|
|
|
|
|
// GetEmbedded - if files required for freebsd, put here
|
|
// GetEmbedded - if files required for freebsd, put here
|