Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Process ¶
type Process struct {
// contains filtered or unexported fields
}
Process wraps exec.Cmd providing channels for stdout and stderr.
Example ¶
package main import ( "context" "fmt" "github.com/kmlib/process" ) func main() { proc, err := process.New(context.Background(), "sh", "-c", "echo stdout1; echo stdout2; echo 1>&2 stderr1; echo 1>&2 stderr2") if err != nil { panic(err) } if err := proc.Start(); err != nil { panic(err) } for line := range proc.Stderr() { fmt.Println(line) } for line := range proc.Stdout() { fmt.Println(line) } if err := proc.Wait(); err != nil { panic(err) } }
Output: stderr1 stderr2 stdout1 stdout2
func (*Process) Start ¶
Start starts the process, and it does not wait for the completion of the process.
Click to show internal directories.
Click to hide internal directories.