github.com/scorpionis/hub@v2.2.1+incompatible/Godeps/_workspace/src/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  	"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  }