()
| 194 | } |
| 195 | |
| 196 | func ExampleErrTimeout() { |
| 197 | cmd := &com.Command{ |
| 198 | Binary: "sleep", |
| 199 | Args: []string{"3600"}, |
| 200 | Timeout: time.Second, |
| 201 | } |
| 202 | |
| 203 | err := cmd.Run(context.Background()) |
| 204 | if err != nil { |
| 205 | fmt.Println("Run err:", err) |
| 206 | |
| 207 | return |
| 208 | } |
| 209 | |
| 210 | exec, err := cmd.Wait() |
| 211 | fmt.Println("Wait err:", err) |
| 212 | fmt.Println("Exit code:", exec.ExitCode) |
| 213 | fmt.Println("Stdout:") |
| 214 | fmt.Println(exec.Stdout) |
| 215 | fmt.Println("Stderr:") |
| 216 | fmt.Println(exec.Stderr) |
| 217 | |
| 218 | // Output: |
| 219 | // Wait err: command timed out |
| 220 | // Exit code: -1 |
| 221 | // Stdout: |
| 222 | // |
| 223 | // Stderr: |
| 224 | // |
| 225 | } |
| 226 | |
| 227 | func ExampleErrFailedStarting() { |
| 228 | cmd := &com.Command{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…