MCPcopy Create free account
hub / github.com/containerd/nerdctl / ExampleCommand

Function ExampleCommand

mod/tigron/internal/com/package_example_test.go:31–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29)
30
31func 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
65func ExampleCommand_Signal() {
66 cmd := com.Command{

Callers

nothing calls this directly

Calls 3

RunMethod · 0.95
WaitMethod · 0.95
BackgroundMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…