Help us shape the future of Go! Take the 2026 Go Developer Survey

process

package
v0.239.0-rc.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLocked = errors.New("locked by another process")

ErrLocked is LockFile's answer while another holder has the file locked.

Functions

func Command

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

Command is exec.Command for a child that must never open its own console window. On windows a console child of a parent without a console gets a fresh window, so infer running under a GUI host flashes one per spawn.

func CommandContext

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

CommandContext is exec.CommandContext with the same console suppression as Command.

func Detach added in v0.239.0

func Detach(cmd *exec.Cmd)

Detach makes cmd's process outlive the caller's terminal: it starts in a session (a process group on windows) of its own, so closing the terminal or its Ctrl+C never reaches it.

func KillTreeOnCancel added in v0.233.2

func KillTreeOnCancel(cmd *exec.Cmd)

KillTreeOnCancel kills the command and every process it started on timeout or cancel, on every platform, so a script's children die too and stop holding its output pipes open. A descendant whose parent already exited is reparented out of the tree and survives: job objects or cgroups if that ever shows up.

func LockFile added in v0.239.0

func LockFile(path string) (*os.File, error)

LockFile opens the file at path, creating it, and locks it for this process without waiting, or returns ErrLocked. Closing the file releases the lock, and so does the process exiting, however it exits, so a lock never outlives its holder.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL