enginestart

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 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 enginestart gives a command a client connected to the machine's engine, starting the engine first when it is not running, and stops it on request. Map and check commands never use it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(ctx context.Context, o Options) (*client.Client, error)

Connect returns a client connected to the engine on o.Dir, which has answered engine.status. When no engine answers it starts one, and when the engine it reached was just exiting idle it starts one again, once.

func Start

func Start(ctx context.Context, o Options) (started bool, err error)

Start starts the engine on o.Dir unless one already answers, and returns once an engine answers engine.status. started is true only when the engine that answers is a child this call spawned. Two Starts at once leave one engine: the lock decides, and a child that lost it is spawned again, 100ms apart, until an engine answers or 5s pass.

func Stop

func Stop(ctx context.Context, dir string) (stopped bool, err error)

Stop stops the engine on dir and waits until it is gone. stopped is false, with no error, when no engine answers.

Types

type Options

type Options struct {
	Dir  string        // the engine's directory, absolute
	Idle time.Duration // the started engine's idle time; ≤ 0 means engine.DefaultIdle
	// Command builds the engine's process for dir and idle. nil runs this
	// executable as `engine run --dir <dir> --idle <idle>`.
	Command func(dir string, idle time.Duration) *exec.Cmd
}

Options say which engine to connect to and how to start it.

Jump to

Keyboard shortcuts

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