]> Cypherpunks.ru repositories - goredo.git/blobdiff - run.go
$1 touching check only if file was known before
[goredo.git] / run.go
diff --git a/run.go b/run.go
index 589889e3db6edbf62f51f626e5f9ed04394323fd..824f6c255ee45a0a165577c2d56f706d9627ebcd 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
+                               }
                        }
                }