run executes each registered task.
()
| 71 | |
| 72 | // run executes each registered task. |
| 73 | func (r *Runner) run() error { |
| 74 | for id, task := range r.tasks { |
| 75 | // Check for an interrupt signal from the OS. |
| 76 | if r.gotInterrupt() { |
| 77 | return ErrInterrupt |
| 78 | } |
| 79 | |
| 80 | // Execute the registered task. |
| 81 | task(id) |
| 82 | } |
| 83 | |
| 84 | return nil |
| 85 | } |
| 86 | |
| 87 | // gotInterrupt verifies if the interrupt signal has been issued. |
| 88 | func (r *Runner) gotInterrupt() bool { |