()
| 65 | } |
| 66 | |
| 67 | func (r WrappedWindowsTask) GetCommandToRun() string { |
| 68 | var commands []string |
| 69 | for _, action := range r.Definition.Actions { |
| 70 | |
| 71 | if action.GetType() != taskmaster.TASK_ACTION_EXEC { |
| 72 | // We only support actions of type Exec, not com, email, or message (which are deprecated) |
| 73 | continue |
| 74 | } |
| 75 | |
| 76 | execAction := action.(taskmaster.ExecAction) |
| 77 | |
| 78 | // If this action is already wrapped with cronitor.exe, extract the underlying command |
| 79 | // The wrapper format is: cronitor.exe [flags...] exec <key> <original_path> <original_args> |
| 80 | // Flags like --env, --no-stdout may appear before "exec" |
| 81 | if strings.HasSuffix(strings.ToLower(execAction.Path), "cronitor.exe") { |
| 82 | args := strings.TrimSpace(execAction.Args) |
| 83 | // Find "exec " in the args - it may not be at the start due to flags |
| 84 | execIndex := strings.Index(args, "exec ") |
| 85 | if execIndex != -1 { |
| 86 | // Get everything after "exec " |
| 87 | remainder := args[execIndex+5:] // len("exec ") = 5 |
| 88 | // Skip the monitor key (first space-delimited token) |
| 89 | parts := strings.SplitN(remainder, " ", 2) |
| 90 | if len(parts) == 2 { |
| 91 | commands = append(commands, strings.TrimSpace(parts[1])) |
| 92 | continue |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | commands = append(commands, strings.TrimSpace(fmt.Sprintf("%s %s", execAction.Path, execAction.Args))) |
| 98 | } |
| 99 | |
| 100 | return strings.Join(commands, " && ") |
| 101 | } |
| 102 | |
| 103 | func (r WrappedWindowsTask) GetNextRunTime() int64 { |
| 104 | return r.NextRunTime.Unix() |
no outgoing calls
no test coverage detected