Documentation
¶
Index ¶
- Variables
- func Command(name string, args ...string) *exec.Cmd
- func CommandContext(ctx context.Context, name string, args ...string) *exec.Cmd
- func Detach(cmd *exec.Cmd)
- func KillTreeOnCancel(cmd *exec.Cmd)
- func LockFile(path string) (*os.File, error)
- func StartedBy(ctx context.Context, pid, ancestor int) bool
Constants ¶
This section is empty.
Variables ¶
var ErrLocked = errors.New("locked by another process")
ErrLocked is LockFile's answer while another holder has the file locked.
Functions ¶
func Command ¶
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 ¶
CommandContext is exec.CommandContext with the same console suppression as Command.
func Detach ¶ added in v0.239.0
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
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.
Types ¶
This section is empty.