cmdrun

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrExitCode1 = errors.New("exit code 1")

Functions

func Run

func Run(
	ctx context.Context, workDir string, envVars []string,
	logger *slog.Logger,
	cmd string, args ...string,
) (out []byte, err error)

Run runs an arbitrary command and returns (output, ErrExitCode1) if it exits with error code 1, otherwise returns the original error.

func RunTemplFmt added in v0.8.0

func RunTemplFmt(ctx context.Context, workDir string, path string) error

RunTemplFmt runs `templ fmt <path>`.

func RunTemplWatch

func RunTemplWatch(
	ctx context.Context,
	workDir string,
	logger *slog.Logger,
	st *statetrack.Tracker,
	templChange chan<- TemplChange,
) error

RunTemplWatch starts `templ generate --log-level debug --watch` and reads its stdout pipe for failure and success logs updating the state accordingly. When ctx is canceled the interrupt signal is sent to the watch process and graceful shutdown is awaited.

func Sh

func Sh(ctx context.Context, workDir string, logger *slog.Logger, sh string) (out []byte, err error)

Sh runs an arbitrary shell script and behaves similar to Run.

Types

type TemplChange added in v0.10.21

type TemplChange int8
const (
	TemplChangeNeedsRestart TemplChange
	TemplChangeNeedsBrowserReload
)

Jump to

Keyboard shortcuts

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