]> Cypherpunks.ru repositories - goredo.git/blobdiff - main.go
Fix dependencies relative paths determination
[goredo.git] / main.go
diff --git a/main.go b/main.go
index cd897720079423090d8e7dca9ad754dba162e2a4..ed82856be37f842e6c66f9a0607d191388cb40ac 100644 (file)
--- a/main.go
+++ b/main.go
@@ -1,6 +1,6 @@
 /*
 goredo -- redo implementation on pure Go
-Copyright (C) 2020 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2020-2021 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -112,6 +112,7 @@ func main() {
                        panic(err)
                }
        }
+       DirPrefix = os.Getenv(EnvDirPrefix)
 
        if *flagStderrKeep {
                mustSetenv(EnvStderrKeep, "1")
@@ -199,7 +200,10 @@ func main() {
        ok := true
        err = nil
        cmdName := path.Base(os.Args[0])
-       trace(CDebug, "[%s] run: %s %s [%s]", BuildUUID, cmdName, tgts, Cwd)
+       trace(
+               CDebug, "[%s] run: %s %s cwd:%s dirprefix:%s",
+               BuildUUID, cmdName, tgts, Cwd, DirPrefix,
+       )
 
 CmdSwitch:
        switch cmdName {
@@ -212,7 +216,9 @@ CmdSwitch:
                }
        case "redo-ifchange":
                ok, err = ifchange(tgts, false, traced)
-               writeDeps(fdDep, tgts)
+               if err == nil {
+                       err = writeDeps(fdDep, tgts)
+               }
        case "redo-ifcreate":
                if fdDep == nil {
                        log.Fatalln("no", EnvDepFd)