Commit 2b7a08c3 authored by André Carvalho's avatar André Carvalho Committed by Brad Fitzpatrick

os/exec: add example for Cmd.Run

Change-Id: Ic47198bc8bf5baabfcf4d0599825eab30d7b126c
Reviewed-on: https://go-review.googlesource.com/48853Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent ba6cd156
......@@ -57,6 +57,13 @@ func ExampleCmd_Output() {
fmt.Printf("The date is %s\n", out)
}
func ExampleCmd_Run() {
cmd := exec.Command("sleep", "1")
log.Printf("Running command and waiting for it to finish...")
err := cmd.Run()
log.Printf("Command finished with error: %v", err)
}
func ExampleCmd_Start() {
cmd := exec.Command("sleep", "5")
err := cmd.Start()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment