2.6 KiB
2.6 KiB
proc
Import: dappco.re/go/core/container/internal/proc
Files: 1
Types
Process
type Process struct
Lightweight wrapper around an OS process ID.
Pid int: Operating-system process ID.
Command
type Command struct
Minimal process runner built directly on syscall.StartProcess.
Path string: Executable name or path to start.Args []string: Full argument vector passed to the child process, including the command name at index 0.Dir string: Working directory for the child process.Env []string: Child environment. When nil,StartusesEnviron().Stdin io.Reader: Reader wired to child stdin when it exposes a file descriptor.Stdout io.Writer: Writer wired to child stdout when it exposes a file descriptor.Stderr io.Writer: Writer wired to child stderr when it exposes a file descriptor.Process *Process: Populated afterStartsucceeds.
Functions
Top-Level Functions
Environ() []string: Returns the current process environment fromsyscall.Environ.NewCommandContext(ctx context.Context, name string, args ...string) *Command: Constructs a command with the supplied context and an argument vector beginning withname.NewCommand(name string, args ...string) *Command: Shorthand forNewCommandContext(context.Background(), name, args...).LookPath(name string) (string, error): Resolves an executable path fromPATHusingPSas the path separator when set, or validates a direct path whennamealready contains a slash or backslash.
Process
(*Process).Kill() error: SendsSIGKILLto the process whenPidis valid, and otherwise does nothing.(*Process).Signal(sig syscall.Signal) error: Sends the requested signal whenPidis valid, and otherwise does nothing.
Command
(*Command).StdoutPipe() (io.ReadCloser, error): Creates a stdout pipe that must be requested beforeStart.(*Command).StderrPipe() (io.ReadCloser, error): Creates a stderr pipe that must be requested beforeStart.(*Command).Start() error: Resolves the executable, maps stdin/stdout/stderr to real file descriptors or/dev/null, starts the child withsyscall.StartProcess, closes child pipe ends in the parent, and arranges for context cancellation to kill the process.(*Command).Run() error: CallsStartand thenWait.(*Command).Output() ([]byte, error): Captures stdout throughStdoutPipe, starts the process, reads all output, waits for exit, and returns any read or process error.(*Command).Wait() error: Waits on the child process withsyscall.Wait4, caches the result, and returns an error for non-zero exit status or terminating signals.