From 04ff41c301c0002b86ecfa24ed92dde2ff90cd6f Mon Sep 17 00:00:00 2001 From: Amir Abushareb Date: Sun, 16 Feb 2020 10:37:27 +0200 Subject: [PATCH] task: fix script path resolve() closes #35. --- main.go | 2 +- task/task.go | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 299a8d7..379b24f 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,7 @@ import ( "github.com/tj/robo/config" ) -var version = "0.5.4" +var version = "0.5.5" const usage = ` Usage: diff --git a/task/task.go b/task/task.go index 28d480b..dfabbe0 100644 --- a/task/task.go +++ b/task/task.go @@ -49,8 +49,13 @@ func (t *Task) Run(args []string) error { // RunScript runs the target shell `script` file. func (t *Task) RunScript(args []string) error { - path := filepath.Join(t.LookupPath, t.Script) - bin := path + var path = t.Script + var bin = path + + if !strings.HasPrefix(path, "/") { + path = filepath.Join(t.LookupPath, t.Script) + bin = path + } stat, err := os.Stat(path) if err != nil {