Repository navigation
Releases
Process v0.2.0: reusable runners and worker cleanup
Run commands with reusable settings, test them without launching subprocesses, and stop their workers when the work ends.
go get github.com/goforj/processConfigure once, run again
Reuse a working directory, environment, input, and timeout across commands. Each invocation gets fresh execution state.
runner := process.NewRunner().
Timeout(30 * time.Second).
WithProcessTree()
result, err := runner.Run(ctx, "go", "test", "./...")Clean up the whole command
- Opt into descendant cleanup on Linux, macOS, and Windows with
WithProcessTree(). - Cancel commands, enforce timeouts, or terminate background work without leaving contained workers running.
- Give Unix workers a grace period to finish cleanup, then stop remaining processes.
Test application code without real commands
Accept process.Executor and use processtest.Fake to queue results and inspect requested commands. Unexpected calls fail instead of launching a subprocess.
More control, clearer examples
- Bound inherited output-pipe draining with
WaitDelay. - Distinguish idle timeouts, total timeouts, and unsuccessful exits.
- Browse 94 runnable examples, including error handling that preserves deferred cleanup.
Upgrading
Existing command APIs and defaults remain available. Descendant cleanup is opt-in. Go 1.27 or newer is required.
The accidental v1.0.0 and corrective v1.0.1 tags are retracted. If you pinned either version, explicitly switch your requirement to v0.2.0.
See examples and API usage and execution behavior for platform details.
Process v0.1.0: commands, pipelines, and streaming
Run commands, stream output, and manage subprocesses through a fluent Go API. The repository includes the library's development and release history.
What's included
- Commands and pipelines with streaming callbacks, timeouts, and graceful shutdown.
- Typed JSON and YAML output decoding.
- Completion notifications and process IDs for asynchronous work.
- Optional output capture, so streamed output does not need a second copy in memory.
Why Process
Process names the library's responsibility directly: running commands and managing subprocesses.
Try it
go get github.com/goforj/processRequires Go 1.27 or newer. See the quick start and examples.
Process v1.2.2: module migration guidance
Add module migration guidance while keeping existing imports and version pins available. This maintenance release makes no runtime changes.
Historical source snapshot. For the current Go module, see v0.1.0.
Process v1.2.1: terminal dependency updates
Update terminal dependencies to golang.org/x/sys v0.50.0 and golang.org/x/term v0.48.0.
Requires Go 1.27 or newer.
Historical source snapshot. For the current Go module, see v0.1.0.
Process v1.2.0: typed decoding and pipeline fixes
Decode command output with typed results, and unblock pipelines when a consumer exits.
Requires Go 1.27 or newer.
Historical source snapshot. For the current Go module, see v0.1.0.
Process v1.1.4: reliable terminal output
Keep waiting through transient PTY read interruptions on Linux and macOS, so output collection continues until the terminal finishes.
Historical source snapshot. For the current Go module, see v0.1.0.
Process v1.1.3: clean terminal completion
Treat normal Unix terminal hangup as the end of output. Successful PTY commands finish without a misleading read error, while other I/O failures remain visible.
Historical source snapshot. For the current Go module, see v0.1.0.
Process v1.1.2: safer pipeline lifecycles
Handle startup, cancellation, and I/O failures without leaving pipeline stages behind. Output callbacks and caller-provided writers are serialized within each pipeline.
Historical source snapshot. For the current Go module, see v0.1.0.
Process v1.1.1: smaller module downloads
Keep documentation tools and runnable examples outside the runtime module, so applications download only the dependencies they need.
Historical source snapshot. For the current Go module, see v0.1.0.
Process v1.1.0: pseudo-terminal support
Run interactive commands through a pseudo-terminal on Linux and macOS.
Historical source snapshot. For the current Go module, see v0.1.0.