Attempt to spawn a session; returns error string if spawn throws.
( spawner: SessionSpawner, opts: SessionSpawnOpts, dir: string, )
| 131 | |
| 132 | /** Attempt to spawn a session; returns error string if spawn throws. */ |
| 133 | function safeSpawn( |
| 134 | spawner: SessionSpawner, |
| 135 | opts: SessionSpawnOpts, |
| 136 | dir: string, |
| 137 | ): SessionHandle | string { |
| 138 | try { |
| 139 | return spawner.spawn(opts, dir) |
| 140 | } catch (err) { |
| 141 | const errMsg = errorMessage(err) |
| 142 | logError(new Error(`Session spawn failed: ${errMsg}`)) |
| 143 | return errMsg |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | export async function runBridgeLoop( |
| 148 | config: BridgeConfig, |
no test coverage detected