subprocess

package
v1.11.3-codec-cleanup Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: BSD-3-Clause Imports: 18 Imported by: 2

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 logging.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              logging.Logger
}

type Status

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

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.

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.

TODO: create the listener inside this method once we refactor the tests

Jump to

Keyboard shortcuts

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