syncthing/vendor/github.com/kardianos/osext/osext_plan9.go

21 lines
411 B
Go
Raw Normal View History

2014-05-02 08:05:48 +00:00
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package osext
2014-07-06 21:13:10 +00:00
import (
"os"
"strconv"
"syscall"
2014-07-06 21:13:10 +00:00
)
2014-05-02 08:05:48 +00:00
func executable() (string, error) {
f, err := os.Open("/proc/" + strconv.Itoa(os.Getpid()) + "/text")
if err != nil {
return "", err
}
defer f.Close()
return syscall.Fd2path(int(f.Fd()))
2014-05-02 08:05:48 +00:00
}