package reexec

import "github.com/containers/storage/pkg/reexec"

Index

Functions

func Command

func Command(args ...string) *exec.Cmd

Command returns *exec.Cmd which has Path as current binary. This will use the in-memory version (/proc/self/exe) of the current binary, it is thus safe to delete or replace the on-disk binary (os.Args[0]).

func CommandContext

func CommandContext(ctx context.Context, args ...string) *exec.Cmd

CommandContext returns *exec.Cmd which has Path as current binary. This will use the in-memory version (/proc/self/exe) of the current binary, it is thus safe to delete or replace the on-disk binary (os.Args[0]).

func Init

func Init() bool

Init is called as the first part of the exec process and returns true if an initialization function was called.

func Register

func Register(name string, initializer func())

Register adds an initialization func under the specified name

func Self

func Self() string

Self returns the path to the current process's binary. Returns "/proc/self/exe".

Source Files

command_linux.go reexec.go

Version
v1.58.0 (latest)
Published
Apr 15, 2025
Platform
linux/amd64
Imports
5 packages
Last checked
3 weeks ago

Tools for package owners.