MCPcopy Index your code
hub / github.com/docker/docker-agent / monitorJob

Method monitorJob

pkg/tools/builtin/shell/shell.go:382–404  ·  view source on GitHub ↗
(job *backgroundJob, cmd *exec.Cmd)

Source from the content-addressed store, hash-verified

380}
381
382func (h *shellHandler) monitorJob(job *backgroundJob, cmd *exec.Cmd) {
383 err := cmd.Wait()
384
385 job.outputMu.Lock()
386 defer job.outputMu.Unlock()
387
388 if job.status.Load() == statusStopped {
389 return
390 }
391
392 if err != nil {
393 if exitErr, ok := errors.AsType[*exec.ExitError](err); ok {
394 job.exitCode = exitErr.ExitCode()
395 } else {
396 job.exitCode = -1
397 }
398 job.status.Store(statusFailed)
399 job.err = err
400 } else {
401 job.exitCode = 0
402 job.status.Store(statusCompleted)
403 }
404}
405
406func (h *shellHandler) ListBackgroundJobs(_ context.Context, _ map[string]any) (*tools.ToolCallResult, error) {
407 var output strings.Builder

Callers 1

RunShellBackgroundMethod · 0.95

Calls 5

LoadMethod · 0.80
WaitMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45
StoreMethod · 0.45

Tested by

no test coverage detected