MCPcopy Index your code
hub / github.com/codeaashu/claude-code / safeSpawn

Function safeSpawn

src/bridge/bridgeMain.ts:127–139  ·  view source on GitHub ↗

Attempt to spawn a session; returns error string if spawn throws.

(
  spawner: SessionSpawner,
  opts: SessionSpawnOpts,
  dir: string,
)

Source from the content-addressed store, hash-verified

125
126/** Attempt to spawn a session; returns error string if spawn throws. */
127function 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
141export async function runBridgeLoop(
142 config: BridgeConfig,

Callers 1

runBridgeLoopFunction · 0.85

Calls 3

logErrorFunction · 0.70
errorMessageFunction · 0.50
spawnMethod · 0.45

Tested by

no test coverage detected