(context *cli.Context)
| 153 | } |
| 154 | |
| 155 | func 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 | |
| 196 | func getProcess(context *cli.Context, c *libcontainer.Container) (*specs.Process, error) { |
| 197 | if path := context.String("process"); path != "" { |
no test coverage detected
searching dependent graphs…