github.com/gogf/selfupdate@v0.0.0-20231215043001-5c48c528462f/internal/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 "os" 9 "strconv" 10 "syscall" 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 }