()
| 138 | * For instance when running `hapi runner status` we can show more information. |
| 139 | */ |
| 140 | export async function checkIfRunnerRunningAndCleanupStaleState(): Promise<boolean> { |
| 141 | const state = await readRunnerState(); |
| 142 | if (!state) { |
| 143 | return false; |
| 144 | } |
| 145 | |
| 146 | // Check if the runner is running |
| 147 | if (isProcessAlive(state.pid)) { |
| 148 | return true; |
| 149 | } |
| 150 | |
| 151 | logger.debug('[RUNNER RUN] Runner PID not running, cleaning up state'); |
| 152 | await cleanupRunnerState(); |
| 153 | return false; |
| 154 | } |
| 155 | |
| 156 | /** |
| 157 | * Check if the running runner version matches the current CLI version. |
no test coverage detected