devserver

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChildConfig

type ChildConfig struct {
	Args     []string
	Command  string
	CWD      string
	Env      map[string]string
	ReadyURL string

	// Stdout and Stderr receive the child's output. Nil means the child
	// inherits nimbu's own stdout/stderr (raw passthrough).
	Stdout io.Writer
	Stderr io.Writer
}

ChildConfig configures the child development server process.

type Console added in v0.5.0

type Console struct {
	// contains filtered or unexported fields
}

Console serializes line-oriented output from several sources onto shared terminal streams: the child dev server, the proxy request log and nimbu's own notices. Every source is line-buffered and writes whole lines under one lock, so no line ever lands in the middle of another.

A source whose line stays unterminated (a "Compiling..." prompt) is shown after a short delay. When another source then needs the screen, the open line is ended first; when the first source continues, its prefix is repeated on the new line.

func NewConsole added in v0.5.0

func NewConsole() *Console

NewConsole returns a Console with the default partial-line delay.

func (*Console) Writer added in v0.5.0

func (c *Console) Writer(dst io.Writer, prefix string) *ConsoleWriter

Writer returns a source that writes to dst, starting every line with prefix. prefix may carry ANSI styling; an empty prefix passes lines through unchanged.

type ConsoleWriter added in v0.5.0

type ConsoleWriter struct {
	// contains filtered or unexported fields
}

ConsoleWriter is one output source attached to a Console.

func (*ConsoleWriter) Close added in v0.5.0

func (w *ConsoleWriter) Close() error

Close emits any buffered partial line and ends a line left open on screen.

func (*ConsoleWriter) Write added in v0.5.0

func (w *ConsoleWriter) Write(p []byte) (int, error)

Write buffers p and emits every complete line. It never returns a short count: output errors are sticky and reported on the next Write.

type Process

type Process struct {
	// contains filtered or unexported fields
}

Process supervises the child development server.

func NewProcess

func NewProcess(config ChildConfig) *Process

func (*Process) ExitCh

func (p *Process) ExitCh() <-chan error

func (*Process) Kill added in v0.5.0

func (p *Process) Kill(timeout time.Duration) error

Kill force-kills the child's whole process tree immediately and waits up to timeout for it to be reaped. It is the second-Ctrl-C path.

func (*Process) Start

func (p *Process) Start() error

func (*Process) Stop

func (p *Process) Stop(gracePeriod time.Duration) error

Stop asks the child's process tree to exit and force-kills it after gracePeriod. If the interrupt cannot be delivered at all, it kills at once instead of waiting out the grace period.

func (*Process) WaitReady

func (p *Process) WaitReady(ctx context.Context, timeout time.Duration) error

Jump to

Keyboard shortcuts

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