From 20470f544f3593177a5b54791eb4b4e55ef64213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Salm=C4=81n=20Aljamm=C4=81z?= Date: Wed, 5 Nov 2014 18:38:03 +0000 Subject: [PATCH] Help devcam find itself correctly on OS X This implements osutil.SelfPath on darwin by trying a $PATH lookup using the command invocation name. Stops the nagging "couldn't stat devcam binary" message on OS X. Change-Id: I42c7f5c30148d810ca753e0812b772db24e93356 --- pkg/osutil/restart_unix.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/osutil/restart_unix.go b/pkg/osutil/restart_unix.go index 81903f4d5..84d5a5cb7 100644 --- a/pkg/osutil/restart_unix.go +++ b/pkg/osutil/restart_unix.go @@ -23,6 +23,7 @@ import ( "errors" "fmt" "os" + "os/exec" "runtime" "syscall" ) @@ -50,7 +51,7 @@ func SelfPath() (string, error) { case "darwin": // TODO(mpl): maybe do the right thing for darwin too, but that may require changes to runtime. // See https://codereview.appspot.com/6736069/ - return os.Args[0], nil + return exec.LookPath(os.Args[0]) } return "", errors.New("SelfPath not implemented for " + runtime.GOOS) }