diff --git a/sys/sys.go b/sys/sys.go index 2d7f0ab..24bae46 100644 --- a/sys/sys.go +++ b/sys/sys.go @@ -45,6 +45,16 @@ func RunShellCmd(call string) int { return ManageStatusCmd(cmd, cmd.Run()) } +func RunBufferedShellCmd(call string, out *bytes.Buffer) int { + cmd := exec.Command("sh", "-c", call) + rs1, err := cmd.CombinedOutput() + if err != nil { + fmt.Println("Error: ", err) + } + out.Write(rs1) + return ManageStatusCmd(cmd, err) +} + func ManageStatusCmd(cmd *exec.Cmd, err error) int { if err == nil { return 0