MCPcopy
hub / github.com/opencontainers/runc / execProcess

Function execProcess

exec.go:155–194  ·  view source on GitHub ↗
(context *cli.Context)

Source from the content-addressed store, hash-verified

153}
154
155func execProcess(context *cli.Context) (int, error) {
156 container, err := getContainer(context)
157 if err != nil {
158 return -1, err
159 }
160 status, err := container.Status()
161 if err != nil {
162 return -1, err
163 }
164 if status == libcontainer.Stopped {
165 return -1, errors.New("cannot exec in a stopped container")
166 }
167 if status == libcontainer.Paused && !context.Bool("ignore-paused") {
168 return -1, errors.New("cannot exec in a paused container (use --ignore-paused to override)")
169 }
170 p, err := getProcess(context, container)
171 if err != nil {
172 return -1, err
173 }
174
175 cgPaths, err := getSubCgroupPaths(context.StringSlice("cgroup"))
176 if err != nil {
177 return -1, err
178 }
179
180 r := &runner{
181 enableSubreaper: false,
182 shouldDestroy: false,
183 container: container,
184 consoleSocket: context.String("console-socket"),
185 pidfdSocket: context.String("pidfd-socket"),
186 detach: context.Bool("detach"),
187 pidFile: context.String("pid-file"),
188 action: CT_ACT_RUN,
189 init: false,
190 preserveFDs: context.Int("preserve-fds"),
191 subCgroupPaths: cgPaths,
192 }
193 return r.run(p)
194}
195
196func getProcess(context *cli.Context, c *libcontainer.Container) (*specs.Process, error) {
197 if path := context.String("process"); path != "" {

Callers 1

exec.goFile · 0.85

Calls 6

runMethod · 0.95
getContainerFunction · 0.85
getProcessFunction · 0.85
getSubCgroupPathsFunction · 0.85
StatusMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…