diff options
Diffstat (limited to 'executil/executil.go')
-rw-r--r-- | executil/executil.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/executil/executil.go b/executil/executil.go index 0617910..1ef20c7 100644 --- a/executil/executil.go +++ b/executil/executil.go @@ -4,6 +4,7 @@ import ( "bytes" "fmt" "html/template" + "os" "os/exec" "strings" ) @@ -28,7 +29,9 @@ func compileCommand(tmpl string, data CommandData) (*exec.Cmd, error) { return nil, fmt.Errorf("template compiled to empty command") } cmd := exec.Command(argv[0], argv[1:]...) - cmd.Dir = data.Dir + if _, err := os.Stat(data.Dir); err == nil { + cmd.Dir = data.Dir + } return cmd, nil } |