add RunEcho()

This commit is contained in:
Jeff Carr 2024-12-10 01:48:49 -06:00
parent cb04f3585c
commit c1e3282864
1 changed files with 12 additions and 5 deletions

View File

@ -25,11 +25,18 @@ func (repo *Repo) Run(cmd []string) cmd.Status {
func (repo *Repo) RunQuiet(cmd []string) cmd.Status {
result := shell.PathRunQuiet(repo.FullPath, cmd)
output := strings.Join(result.Stdout, "\n")
if result.Error != nil {
log.Warn("cmd:", cmd)
log.Warn("ouptput:", output)
log.Warn("failed with error:", result.Error)
return result
}
func (repo *Repo) RunEcho(cmd []string) cmd.Status {
result := shell.PathRunQuiet(repo.FullPath, cmd)
log.Info("cmd:", repo.FullPath, cmd)
log.Warn("cmd.Exit:", result.Exit, "cmd.Error:", result.Error)
for _, line := range result.Stdout {
log.Info("STDOUT:", line)
}
for _, line := range result.Stderr {
log.Info("STDERR:", line)
}
return result
}