]> Cypherpunks.ru repositories - goredo.git/blobdiff - run.go
Ability to disable redo progress printing at all
[goredo.git] / run.go
diff --git a/run.go b/run.go
index 589889e3db6edbf62f51f626e5f9ed04394323fd..512418b6e448206ba58c1bd7f3e366197c67bd78 100644 (file)
--- a/run.go
+++ b/run.go
@@ -458,14 +458,16 @@ func runScript(tgtOrig string, errs chan error, traced bool) error {
                }
 
                // Was $1 touched?
-               if fd, err := os.Open(path.Join(cwdOrig, tgt)); err == nil {
-                       ts, err := fileCtime(fd)
-                       fd.Close()
-                       if err == nil && ts != tsPrev {
-                               runErr.Err = errors.New("$1 was explicitly touched")
-                               errs <- runErr
+               if tsPrev != "" {
+                       if fd, err := os.Open(path.Join(cwdOrig, tgt)); err == nil {
+                               ts, err := fileCtime(fd)
                                fd.Close()
-                               return
+                               if err == nil && ts != tsPrev {
+                                       runErr.Err = errors.New("$1 was explicitly touched")
+                                       errs <- runErr
+                                       fd.Close()
+                                       return
+                               }
                        }
                }
 
@@ -505,6 +507,7 @@ func runScript(tgtOrig string, errs chan error, traced bool) error {
 
                // Do we need to ifcreate it, of ifchange with renaming?
                if fd == nil {
+                       os.Remove(path.Join(cwdOrig, tgt))
                        err = ifcreate(fdDep, tgt)
                        if err != nil {
                                goto Finish