sexec is a simple command execution library written in golang. It currently only works on linux.
$ go get github.com/blang/sexecNote: Always vendor your dependencies or fix on a specific version tag.
import github.com/blang/sexec
p := sexec.NewProcess("while true; do echo test; sleep 1; done", os.Stdout, os.Stderr)
p.Start() // Start in background
p.Signal(syscall.SIGTERM) // Send signals
<- p.WaitCh() // Wait for exit
pid, err:=p.Pid()
code, err:=p.ExitCode()Also check the GoDocs.
- Simple
- Fully tested (Coverage >90%)
- Readable errors
- Only Stdlib
- Exit Codes
- Waiting via channel or method
- Signalling
I needed a simple lib to get ExitCodes and proper Signalling without the hassle around syscall.
Feel free to make a pull request. For bigger changes create a issue first to discuss about it.
See LICENSE file.