github.com/rumpl/bof@v23.0.0-rc.2+incompatible/pkg/reexec/command_unix.go (about)

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