github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/pkg/reexec/command_unix.go (about)

     1  // +build freebsd darwin
     2  
     3  package reexec // import "github.com/demonoid81/moby/pkg/reexec"
     4  
     5  import (
     6  	"os/exec"
     7  )
     8  
     9  // Self returns the path to the current process's binary.
    10  // Uses os.Args[0].
    11  func Self() string {
    12  	return naiveSelf()
    13  }
    14  
    15  // Command returns *exec.Cmd which has Path as current binary.
    16  // For example if current binary is "docker" at "/usr/bin/", then cmd.Path will
    17  // be set to "/usr/bin/docker".
    18  func Command(args ...string) *exec.Cmd {
    19  	return &exec.Cmd{
    20  		Path: Self(),
    21  		Args: args,
    22  	}
    23  }