diff options
Diffstat (limited to 'shell.go')
| -rw-r--r-- | shell.go | 42 |
1 files changed, 14 insertions, 28 deletions
@@ -25,11 +25,6 @@ func (repo *Repo) Run(cmd []string) cmd.Status { return result } -func (repo *Repo) RunQuiet(cmd []string) cmd.Status { - result := shell.PathRunQuiet(repo.FullPath, cmd) - return result -} - func (repo *Repo) RunEcho(cmd []string) cmd.Status { result := shell.PathRunQuiet(repo.FullPath, cmd) log.Log(NOW, "cmd:", repo.FullPath, cmd) @@ -52,35 +47,26 @@ func (repo *Repo) RunRealtimeVerbose(cmd []string) cmd.Status { return shell.PathRunRealtime(repo.GetFullPath(), cmd) } -// error if result.Error or if result.Exit != 0 -func (repo *Repo) RunStrict(cmd []string) error { - return repo.StrictRun(cmd) -} - -func (repo *Repo) StrictRun(cmd []string) error { - result := repo.RunQuiet(cmd) +func (repo *Repo) RunQuiet(cmd []string) (*cmd.Status, error) { + result := shell.RunQuiet(cmd) if result.Error != nil { log.Warn(repo.GetGoPath(), cmd, "wow. golang is cool. an os.Error:", result.Error) - return result.Error + return &result, result.Error } if result.Exit != 0 { - log.Warn(cmd, "failed with", result.Exit) - return errors.New(fmt.Sprint(cmd, "failed with", result.Exit)) + // log.Warn(cmd, "failed with", result.Exit, repo.GetGoPath()) + return &result, errors.New(fmt.Sprint(cmd, "failed with", result.Exit)) } - return nil + return &result, nil } -func (repo *Repo) RunStrictNew(cmd []string) (*cmd.Status, error) { - result := repo.RunQuiet(cmd) - if result.Error != nil { - log.Warn(repo.GetGoPath(), cmd, "wow. golang is cool. an os.Error:", result.Error) - return &result, result.Error - } - if result.Exit != 0 { +func (repo *Repo) RunStrict(cmd []string) (*cmd.Status, error) { + result, err := repo.RunQuiet(cmd) + if err != nil { log.Warn(cmd, "failed with", result.Exit, repo.GetGoPath()) - return &result, errors.New(fmt.Sprint(cmd, "failed with", result.Exit)) + return result, errors.New(fmt.Sprint(cmd, "failed with", result.Exit)) } - return &result, nil + return result, nil } func (repo *Repo) Exists(filename string) bool { @@ -143,7 +129,7 @@ func (repo *Repo) RunAll(all [][]string) bool { func (repo *Repo) RunStrictAll(all [][]string) (*cmd.Status, error) { for _, cmd := range all { log.Log(WARN, "doAll() RUNNING: cmd =", cmd) - if result, err := repo.RunStrictNew(cmd); err != nil { + if result, err := repo.RunStrict(cmd); err != nil { return result, err } } @@ -152,7 +138,7 @@ func (repo *Repo) RunStrictAll(all [][]string) (*cmd.Status, error) { func (repo *Repo) RunVerbose(cmd []string) (*cmd.Status, error) { log.Info("Running:", repo.GetGoPath(), cmd) - r, err := repo.RunStrictNew(cmd) + r, err := repo.RunStrict(cmd) if err != nil { log.Info("Error", cmd, err) } @@ -166,7 +152,7 @@ func (repo *Repo) RunVerbose(cmd []string) (*cmd.Status, error) { } func (repo *Repo) RunVerboseOnError(cmd []string) (*cmd.Status, error) { - r, err := repo.RunStrictNew(cmd) + r, err := repo.RunStrict(cmd) if err == nil { return r, err } |
