X-Git-Url: http://www.git.cypherpunks.ru/?p=goredo.git;a=blobdiff_plain;f=run.go;h=589889e3db6edbf62f51f626e5f9ed04394323fd;hp=c85543a0f8d7b4897bfc1ee65f69ef3b87200c82;hb=3a29962a4bfcb0cf6cdfd112fb87f68751b0a0dc;hpb=0151c27b27d1ff53cdf92488c412ae5cb01c3054 diff --git a/run.go b/run.go index c85543a..589889e 100644 --- a/run.go +++ b/run.go @@ -28,6 +28,7 @@ import ( "os" "os/exec" "path" + "path/filepath" "strings" "sync" "syscall" @@ -306,13 +307,22 @@ func runScript(tgtOrig string, errs chan error, traced bool) error { } // 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