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

subprocess

package
v1.36.184 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCmd

func NewCmd(path string, args ...string) *exec.Cmd

func NewStopper

func NewStopper(logger log.Logger, cmd *exec.Cmd) runtime.Stopper

Types

type Config

type Config struct {
	// Stderr of the VM process written to this writer.
	Stderr io.Writer
	// Stdout of the VM process written to this writer.
	Stdout io.Writer
	// Duration engine server will wait for handshake success.
	HandshakeTimeout time.Duration
	Log              log.Logger
}

Config contains subprocess configuration.

type Status

type Status struct {
	// Id of the process.
	Pid int
	// Address of the VM service.
	Addr string
}

Status contains subprocess status after successful bootstrap.

func Bootstrap

func Bootstrap(
	ctx context.Context,
	listener net.Listener,
	cmd *exec.Cmd,
	config *Config,
) (*Status, runtime.Stopper, error)

Bootstrap starts a VM as a subprocess after initialization completes and pipes the IO to the appropriate writers. Handshake is the ZAP binary framed exchange ([len][protocol version][vm addr]).

The subprocess is expected to be stopped by the caller if a non-nil error is returned. If piping the IO fails then the subprocess will be stopped.

Jump to

Keyboard shortcuts

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