MCPcopy Index your code
hub / github.com/coder/envbox / GetExecPID

Function GetExecPID

dockerutil/exec.go:98–112  ·  view source on GitHub ↗
(ctx context.Context, client Client, execID string)

Source from the content-addressed store, hash-verified

96}
97
98func GetExecPID(ctx context.Context, client Client, execID string) (int, error) {
99 for r := retry.New(time.Second, time.Second); r.Wait(ctx); {
100 inspect, err := client.ContainerExecInspect(ctx, execID)
101 if err != nil {
102 return 0, xerrors.Errorf("exec inspect: %w", err)
103 }
104
105 if inspect.Pid == 0 {
106 continue
107 }
108 return inspect.Pid, nil
109 }
110
111 return 0, ctx.Err()
112}
113
114func WaitForExit(ctx context.Context, client Client, execID string) error {
115 for r := retry.New(time.Second, time.Second); r.Wait(ctx); {

Callers 1

dockerCmdFunction · 0.92

Calls 3

ContainerExecInspectMethod · 0.80
ErrorfMethod · 0.65
WaitMethod · 0.45

Tested by

no test coverage detected