2017-11-01 19:37:53 -04:00
|
|
|
// +build freebsd darwin
|
2015-07-29 14:25:56 -04:00
|
|
|
|
2018-02-05 16:05:59 -05:00
|
|
|
package reexec // import "github.com/docker/docker/pkg/reexec"
|
2015-07-29 14:25:56 -04:00
|
|
|
|
|
|
|
import (
|
|
|
|
"os/exec"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Self returns the path to the current process's binary.
|
|
|
|
// Uses os.Args[0].
|
|
|
|
func Self() string {
|
|
|
|
return naiveSelf()
|
|
|
|
}
|
|
|
|
|
2016-08-01 22:06:38 -04:00
|
|
|
// Command returns *exec.Cmd which has Path as current binary.
|
2015-07-29 14:25:56 -04:00
|
|
|
// For example if current binary is "docker" at "/usr/bin/", then cmd.Path will
|
|
|
|
// be set to "/usr/bin/docker".
|
|
|
|
func Command(args ...string) *exec.Cmd {
|
|
|
|
return &exec.Cmd{
|
|
|
|
Path: Self(),
|
|
|
|
Args: args,
|
|
|
|
}
|
|
|
|
}
|