(actionId: string)
| 96 | } |
| 97 | |
| 98 | async #executeAction(actionId: string) { |
| 99 | const action = this.actions.get()[actionId]; |
| 100 | |
| 101 | this.#updateAction(actionId, { status: 'running' }); |
| 102 | |
| 103 | try { |
| 104 | switch (action.type) { |
| 105 | case 'shell': { |
| 106 | await this.#runShellAction(action); |
| 107 | break; |
| 108 | } |
| 109 | case 'file': { |
| 110 | await this.#runFileAction(action); |
| 111 | break; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | this.#updateAction(actionId, { status: action.abortSignal.aborted ? 'aborted' : 'complete' }); |
| 116 | } catch (error) { |
| 117 | this.#updateAction(actionId, { status: 'failed', error: 'Action failed' }); |
| 118 | |
| 119 | // re-throw the error to be caught in the promise chain |
| 120 | throw error; |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | async #runShellAction(action: ActionState) { |
| 125 | if (action.type !== 'shell') { |
no test coverage detected