( executor: CommandExecutor, )
| 84 | } |
| 85 | |
| 86 | export function createBootSimExecutor( |
| 87 | executor: CommandExecutor, |
| 88 | ): NonStreamingExecutor<ResolvedBootSimParams, BootSimResult> { |
| 89 | return async (params) => { |
| 90 | try { |
| 91 | const result = await executor( |
| 92 | ['xcrun', 'simctl', 'boot', params.simulatorId], |
| 93 | 'Boot Simulator', |
| 94 | false, |
| 95 | ); |
| 96 | |
| 97 | if (!result.success) { |
| 98 | const diagnosticMessage = result.error ?? 'Unknown error'; |
| 99 | return createBootSimResult({ |
| 100 | simulatorId: params.simulatorId, |
| 101 | didError: true, |
| 102 | error: 'Boot simulator operation failed.', |
| 103 | diagnosticMessage, |
| 104 | }); |
| 105 | } |
| 106 | |
| 107 | return createBootSimResult({ |
| 108 | simulatorId: params.simulatorId, |
| 109 | didError: false, |
| 110 | }); |
| 111 | } catch (error) { |
| 112 | const diagnosticMessage = toErrorMessage(error); |
| 113 | return createBootSimResult({ |
| 114 | simulatorId: params.simulatorId, |
| 115 | didError: true, |
| 116 | error: 'Boot simulator operation failed.', |
| 117 | diagnosticMessage, |
| 118 | }); |
| 119 | } |
| 120 | }; |
| 121 | } |
| 122 | |
| 123 | export async function boot_simLogic( |
| 124 | params: BootSimParams, |
no test coverage detected