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

Function ExampleErrTimeout

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

Source from the content-addressed store, hash-verified

194}
195
196func 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
227func ExampleErrFailedStarting() {
228 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…