()
| 29 | ) |
| 30 | |
| 31 | func ExampleCommand() { |
| 32 | cmd := com.Command{ |
| 33 | Binary: "printf", |
| 34 | Args: []string{"hello world"}, |
| 35 | } |
| 36 | |
| 37 | err := cmd.Run(context.Background()) |
| 38 | if err != nil { |
| 39 | fmt.Println("Run err:", err) |
| 40 | |
| 41 | return |
| 42 | } |
| 43 | |
| 44 | exec, err := cmd.Wait() |
| 45 | if err != nil { |
| 46 | fmt.Println("Wait err:", err) |
| 47 | |
| 48 | return |
| 49 | } |
| 50 | |
| 51 | fmt.Println("Exit code:", exec.ExitCode) |
| 52 | fmt.Println("Stdout:") |
| 53 | fmt.Println(exec.Stdout) |
| 54 | fmt.Println("Stderr:") |
| 55 | fmt.Println(exec.Stderr) |
| 56 | |
| 57 | // Output: |
| 58 | // Exit code: 0 |
| 59 | // Stdout: |
| 60 | // hello world |
| 61 | // Stderr: |
| 62 | // |
| 63 | } |
| 64 | |
| 65 | func ExampleCommand_Signal() { |
| 66 | cmd := com.Command{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…