Side by Side Diff: src/pkg/os/executable_procfs.go
Issue 6736069:
code review 6736069: runtime, syscall, os: add os.ExecPath() (string, error)
Patch Set: diff -r 617db9efbdf1 https://code.google.com/p/go/
Use n/p to move between diff chunks;
N/P to move between comments.
Please Sign in to add in-line comments.
Jump to:
OLD | NEW |
(Empty) | |
| 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 // +build linux netbsd openbsd |
| 6 |
| 7 package os |
| 8 |
| 9 import ( |
| 10 "errors" |
| 11 "runtime" |
| 12 ) |
| 13 |
| 14 func executable() (string, error) { |
| 15 switch runtime.GOOS { |
| 16 case "linux": |
| 17 return "/proc/self/exe", nil |
| 18 case "netbsd": |
| 19 return "/proc/curproc/exe", nil |
| 20 case "openbsd": |
| 21 return "/proc/curproc/file", nil |
| 22 } |
| 23 return "", errors.New("Executable not implemented for " + runtime.GOOS) |
| 24 } |
OLD | NEW |