diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-05-23 09:45:29 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-05-23 09:45:29 +0200 |
commit | 63d29fefab5290dc96e0a03ff70603aefa995887 (patch) | |
tree | 95da0105686f9aba568a72e7a8ebd580a4fda20e /misc/dashboard/builder/exec.go | |
parent | ad811fbb8897a9a3063274e927133915941f1dca (diff) | |
download | golang-63d29fefab5290dc96e0a03ff70603aefa995887.tar.gz |
Imported Upstream version 2011.05.22upstream-weekly/2011.05.22
Diffstat (limited to 'misc/dashboard/builder/exec.go')
-rw-r--r-- | misc/dashboard/builder/exec.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/misc/dashboard/builder/exec.go b/misc/dashboard/builder/exec.go index 3c6fbdced..988d216ce 100644 --- a/misc/dashboard/builder/exec.go +++ b/misc/dashboard/builder/exec.go @@ -18,7 +18,7 @@ func run(envv []string, dir string, argv ...string) os.Error { if *verbose { log.Println("run", argv) } - bin, err := pathLookup(argv[0]) + bin, err := lookPath(argv[0]) if err != nil { return err } @@ -36,7 +36,7 @@ func runLog(envv []string, logfile, dir string, argv ...string) (output string, if *verbose { log.Println("runLog", argv) } - bin, err := pathLookup(argv[0]) + bin, err := lookPath(argv[0]) if err != nil { return } @@ -67,10 +67,10 @@ func runLog(envv []string, logfile, dir string, argv ...string) (output string, return b.String(), wait.WaitStatus.ExitStatus(), nil } -// Find bin in PATH if a relative or absolute path hasn't been specified -func pathLookup(s string) (string, os.Error) { - if strings.HasPrefix(s, "/") || strings.HasPrefix(s, "./") || strings.HasPrefix(s, "../") { - return s, nil +// lookPath looks for cmd in $PATH if cmd does not begin with / or ./ or ../. +func lookPath(cmd string) (string, os.Error) { + if strings.HasPrefix(cmd, "/") || strings.HasPrefix(cmd, "./") || strings.HasPrefix(cmd, "../") { + return cmd, nil } - return exec.LookPath(s) + return exec.LookPath(cmd) } |