Package Usage: go: github.com/go-cmd/cmd
Package cmd runs external commands with concurrent access to output and
status. It wraps the Go standard library os/exec.Command to correctly handle
reading output (STDOUT and STDERR) while a command is running and killing a
command. All operations are safe to call from multiple goroutines.
A basic example that runs env and prints its output:
Commands can be ran synchronously (blocking) or asynchronously (non-blocking):
Start returns a channel to which the final Status is sent when the command
finishes for any reason. The first example blocks receiving on the channel.
The second example is non-blocking because it saves the channel and receives
on it later. Only one final status is sent to the channel; use Done for
multiple goroutines to wait for the command to finish, then call Status to
get the final status.
15 versions
Latest release: about 2 years ago
228 dependent packages
View more package details: https://packages.ecosystem.code.gouv.fr/registries/proxy.golang.org/packages/github.com/go-cmd/cmd