MCPcopy
hub / github.com/firecracker-microvm/firecracker-containerd / ExecProcess

Method ExecProcess

internal/vm/task.go:221–263  ·  view source on GitHub ↗
(
	reqCtx context.Context,
	req *taskAPI.ExecProcessRequest,
	taskService taskAPI.TaskService,
	ioProxy IOProxy,
)

Source from the content-addressed store, hash-verified

219}
220
221func (m *taskManager) ExecProcess(
222 reqCtx context.Context,
223 req *taskAPI.ExecProcessRequest,
224 taskService taskAPI.TaskService,
225 ioProxy IOProxy,
226) (_ *types.Empty, err error) {
227 taskID := req.ID
228 execID := req.ExecID
229
230 proc, err := m.newProc(taskID, execID)
231 if err != nil {
232 return nil, err
233 }
234 proc.proxy = ioProxy
235
236 defer func() {
237 if err != nil {
238 proc.cancel()
239 m.deleteProc(taskID, execID)
240 }
241 }()
242
243 // Begin initializing stdio, but don't block on the initialization so we can send the Exec
244 // call (which will allow the stdio initialization to complete).
245 initDone, copyDone := ioProxy.start(proc)
246 proc.ioCopyDone = copyDone
247
248 execResp, err := taskService.Exec(reqCtx, req)
249 if err != nil {
250 return nil, err
251 }
252
253 // make sure stdio was initialized successfully
254 err = <-initDone
255 if err != nil {
256 return nil, err
257 }
258
259 go m.monitorExit(proc, taskService)
260 go monitorIO(copyDone, proc)
261
262 return execResp, nil
263}
264
265func (m *taskManager) DeleteProcess(
266 reqCtx context.Context,

Callers

nothing calls this directly

Calls 6

newProcMethod · 0.95
deleteProcMethod · 0.95
monitorExitMethod · 0.95
monitorIOFunction · 0.85
startMethod · 0.65
ExecMethod · 0.45

Tested by

no test coverage detected