summaryrefslogtreecommitdiff
path: root/shell.go
diff options
context:
space:
mode:
Diffstat (limited to 'shell.go')
-rw-r--r--shell.go25
1 files changed, 19 insertions, 6 deletions
diff --git a/shell.go b/shell.go
index 4098303..3a5fc0d 100644
--- a/shell.go
+++ b/shell.go
@@ -1,9 +1,12 @@
package gitpb
import (
+ "errors"
+ "fmt"
"os"
"path/filepath"
"strings"
+ "time"
"github.com/go-cmd/cmd"
"go.wit.com/lib/gui/shell"
@@ -46,17 +49,17 @@ func (repo *Repo) RunRealtime(cmd []string) cmd.Status {
}
// for now, even check cmd.Exit
-func (repo *Repo) strictRun(cmd []string) (bool, error) {
+func (repo *Repo) StrictRun(cmd []string) error {
result := repo.RunQuiet(cmd)
if result.Error != nil {
- log.Warn("go mod init failed err:", result.Error)
- return false, result.Error
+ log.Warn(repo.GoPath, cmd, "wow. golang is cool. an os.Error:", result.Error)
+ return result.Error
}
if result.Exit != 0 {
- log.Warn("go mod init exit =", result.Exit)
- return false, result.Error
+ log.Warn(cmd, "failed with", result.Exit)
+ return errors.New(fmt.Sprint(cmd, "failed with", result.Exit))
}
- return true, nil
+ return nil
}
func (repo *Repo) Exists(filename string) bool {
@@ -85,3 +88,13 @@ func (repo *Repo) IsDirectory() bool {
}
return info.IsDir()
}
+
+func (repo *Repo) mtime(filename string) (time.Time, error) {
+ pathf := filepath.Join(repo.FullPath, filename)
+ statf, err := os.Stat(pathf)
+ if err == nil {
+ return statf.ModTime(), nil
+ }
+ log.Log(GITPBWARN, "mtime() error", pathf, err)
+ return time.Now(), err
+}