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