Documentation
¶
Overview ¶
Package process starts a plugin as a child process and binds it to the JSON-line protocol over its stdin and stdout. It is a plugin.Backend for plugin.Open. It chooses no executable: the consumer supplies the whole command, including a managed runtime such as an interpreter plus script.
Index ¶
Constants ¶
const DefaultStderrBytes = 4096
DefaultStderrBytes is the retained diagnostic output when none is set.
Variables ¶
This section is empty.
Functions ¶
func Profile ¶
func Profile() plugin.BackendProfile
Profile describes this backend for packagekit entrypoint selection: the "process" runtime speaking plugin.APIVersion over JSON lines, with the host owning the child process.
Types ¶
type Command ¶
type Command struct {
// Path is the executable (a regular file, after following links).
Path string
// Args are the arguments after the executable name.
Args []string
// Dir is the working directory; empty inherits the host's.
Dir string
// Env adds "KEY=value" entries to the scrubbed base environment. The
// host environment is never inherited; the base is PATH, plus SystemRoot
// on Windows.
Env []string
// StderrBytes bounds retained stderr; zero uses DefaultStderrBytes.
StderrBytes int
// KillGrace bounds waiting for pipes after the process is killed.
// Zero uses two seconds.
KillGrace time.Duration
}
Command is the consumer's launch decision.
type Process ¶
Process is a started child and the JSON-line client bound to it. Canceling a call kills the process, and a killed or closed Process cannot be reused: later calls return plugin.ErrClosed.
func Start ¶
Start launches the command. ctx bounds only startup; use plugin.Open (or Handshake) to perform and check the hello exchange.
func (*Process) Stderr ¶
Stderr returns the retained (bounded, possibly truncated) diagnostic output. Treat it as untrusted text. A goroutine copies the child's stderr, so output written just before a reply can arrive a moment after it; Close waits for the copy, and what Stderr returns after Close is complete.