Fork osext and support Solaris

This commit is contained in:
Jakob Borg
2014-09-28 23:10:43 +02:00
parent 174befe729
commit 8f9b8a8550
11 changed files with 11 additions and 9 deletions

View File

@@ -2,12 +2,13 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build linux netbsd openbsd
// +build linux netbsd openbsd solaris
package osext
import (
"errors"
"fmt"
"os"
"runtime"
)
@@ -20,6 +21,8 @@ func executable() (string, error) {
return os.Readlink("/proc/curproc/exe")
case "openbsd":
return os.Readlink("/proc/curproc/file")
case "solaris":
return os.Readlink(fmt.Sprintf("/proc/%d/path/a.out", os.Getpid()))
}
return "", errors.New("ExecPath not implemented for " + runtime.GOOS)
}