(taskID, status string, exitCode *int)
| 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() |
no test coverage detected