( reqCtx context.Context, req *taskAPI.ExecProcessRequest, taskService taskAPI.TaskService, ioProxy IOProxy, )
| 219 | } |
| 220 | |
| 221 | func (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 | |
| 265 | func (m *taskManager) DeleteProcess( |
| 266 | reqCtx context.Context, |
nothing calls this directly
no test coverage detected