github.com/deemoprobe/k8s-first-commit@v0.0.0-20230430165612-a541f1982be3/third_party/bitbucket.org/kardianos/osext/osext_plan9.go (about) 1 // Copyright 2012 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package osext 6 7 import ( 8 "syscall" 9 "os" 10 "strconv" 11 ) 12 13 func executable() (string, error) { 14 f, err := os.Open("/proc/" + strconv.Itoa(os.Getpid()) + "/text") 15 if err != nil { 16 return "", err 17 } 18 defer f.Close() 19 return syscall.Fd2path(int(f.Fd())) 20 }