This example shows how to run a command, wait for it to complete and check if it succeeded.
()
| 34 | |
| 35 | // This example shows how to run a command, wait for it to complete and check if it succeeded. |
| 36 | func ExampleSilent() { |
| 37 | ctx := newCtx() |
| 38 | err := shell.Command("echo", "Hello from the shell").Run(ctx) |
| 39 | if err != nil { |
| 40 | log.F(ctx, true, "Unable to say hello: %v", err) |
| 41 | } |
| 42 | log.I(ctx, "Done") |
| 43 | // Output: |
| 44 | //I: [Example] Done |
| 45 | } |
| 46 | |
| 47 | // This example shows how to run a command, with it's standard out and error being logged. |
| 48 | func ExampleVerbose() { |