* "all" target is default
* stdout is always captured, but no target is created if it was empty
* empty targets are considered always out of date
-* .do's $3 is relative path to the file in same directory
+* .do's $3 is relative path to the file in target directory
* .do search goes up to / by default, but can be limited with either
$REDO_TOP_DIR environment variable, or by having .redo/top file in it
* target's completion messages are written after they finish
"os"
"os/exec"
"path"
+ "path/filepath"
"strings"
"sync"
"syscall"
}
// Temporary file for stdout
- fdStdout, err := tempfile(cwd, tgt)
+ fdStdout, err := tempfile(cwdOrig, tgt)
if err != nil {
cleanup()
return TgtErr{tgtOrig, err}
}
tmpPath := fdStdout.Name() + ".3" // and for $3
- args = append(args, tgt, basename, path.Base(tmpPath))
+ tmpPathRel, err := filepath.Rel(cwd, tmpPath)
+ if err != nil {
+ panic(err)
+ }
+ args = append(
+ args,
+ path.Join(dirPrefix, tgt),
+ path.Join(dirPrefix, basename),
+ tmpPathRel,
+ )
cmd := exec.Command(cmdName, args...)
cmd.Dir = cwd