process

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

type Process struct {
	*jsonline.Client
	// contains filtered or unexported fields
}

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

func Start(ctx context.Context, c Command) (*Process, error)

Start launches the command. ctx bounds only startup; use plugin.Open (or Handshake) to perform and check the hello exchange.

func (*Process) Stderr

func (p *Process) Stderr() string

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.

Jump to

Keyboard shortcuts

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