MCPcopy Index your code
hub / github.com/containerd/containerd / getRuntimeInfo

Function getRuntimeInfo

core/runtime/v2/task_manager.go:346–371  ·  view source on GitHub ↗
(ctx context.Context, shims *ShimManager, req *apitypes.RuntimeRequest)

Source from the content-addressed store, hash-verified

344}
345
346func getRuntimeInfo(ctx context.Context, shims *ShimManager, req *apitypes.RuntimeRequest) (*apitypes.RuntimeInfo, error) {
347 runtimePath, err := shims.resolveRuntimePath(req.RuntimePath)
348 if err != nil {
349 return nil, fmt.Errorf("failed to resolve runtime path: %w", err)
350 }
351 var optsB []byte
352 if req.Options != nil {
353 optsB, err = proto.Marshal(req.Options)
354 if err != nil {
355 return nil, fmt.Errorf("failed to marshal %s: %w", req.Options.TypeUrl, err)
356 }
357 }
358 var stderr bytes.Buffer
359 cmd := exec.CommandContext(ctx, runtimePath, "-info")
360 cmd.Stdin = bytes.NewReader(optsB)
361 cmd.Stderr = &stderr
362 stdout, err := cmd.Output()
363 if err != nil {
364 return nil, fmt.Errorf("failed to run %v: %w (stderr: %q)", cmd.Args, err, stderr.String())
365 }
366 var info apitypes.RuntimeInfo
367 if err = proto.Unmarshal(stdout, &info); err != nil {
368 return nil, fmt.Errorf("failed to unmarshal stdout from %v into %T: %w", cmd.Args, &info, err)
369 }
370 return &info, nil
371}
372
373func (m *TaskManager) PluginInfo(ctx context.Context, request any) (any, error) {
374 req, ok := request.(*apitypes.RuntimeRequest)

Callers 2

loadShimInfoMethod · 0.85
PluginInfoMethod · 0.85

Calls 4

MarshalFunction · 0.92
UnmarshalFunction · 0.92
resolveRuntimePathMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…