MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / finishTask

Method finishTask

tools/bash/background.go:327–341  ·  view source on GitHub ↗
(taskID, status string, exitCode *int)

Source from the content-addressed store, hash-verified

325 timeoutSeconds := formatDurationSeconds(timeout)
326 output := fmt.Sprintf("[Command timed out after %ss]\nCommand: %s\n", timeoutSeconds, task.Command)
327 _ = os.WriteFile(task.OutputPath, []byte(output), 0o600)
328 _ = os.WriteFile(task.ErrorPath, []byte("Timeout after "+timeoutSeconds+"s"), 0o600)
329 m.finishTask(task.TaskID, "failed", nil)
330 return
331 }
332
333 if errors.Is(ctx.Err(), context.Canceled) {
334 terminateProcessTree(cmd)
335 m.finishTask(task.TaskID, "cancelled", nil)
336 return
337 }
338 exitCode := 0
339 if cmd.ProcessState != nil {
340 exitCode = cmd.ProcessState.ExitCode()
341 }
342 output := stdout.String()
343 if stderr.Len() > 0 {
344 output += "\n[stderr]\n" + stderr.String()

Callers 1

runTaskMethod · 0.95

Calls 2

float64PtrFunction · 0.85
nowSecondsFunction · 0.70

Tested by

no test coverage detected