File: daemon_linux.go

package info (click to toggle)
golang-github-vividcortex-godaemon 0.0~git20150910.3d9f6e0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 92 kB
  • sloc: makefile: 2
file content (22 lines) | stat: -rw-r--r-- 590 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package godaemon

// Copyright (c) 2013 VividCortex, Inc. All rights reserved.
// Please see the LICENSE file for applicable license terms.

import (
	"fmt"
	"path/filepath"
)

// GetExecutablePath returns the absolute path to the currently running
// executable.  It is used internally by the godaemon package, and exported
// publicly because it's useful outside of the package too.
func GetExecutablePath() (string, error) {
	exePath, err := Readlink("/proc/self/exe")

	if err != nil {
		err = fmt.Errorf("can't read /proc/self/exe: %v", err)
	}

	return filepath.Clean(exePath), err
}