MCPcopy Index your code
hub / github.com/TanStack/ai / spawnProcess

Method spawnProcess

packages/ai-sandbox-sprites/src/handle.ts:207–233  ·  view source on GitHub ↗
(
    command: string,
    opts?: ProcessOptions,
  )

Source from the content-addressed store, hash-verified

205 }
206
207 private spawnProcess(
208 command: string,
209 opts?: ProcessOptions,
210 ): Promise<SpawnHandle> {
211 const stream = this.client.exec(this.name, {
212 argv: ['bash', '-c', command],
213 cwd: opts?.cwd ? this.abs(opts.cwd) : this.workdir,
214 env: this.mergedEnv(opts?.env),
215 ...(opts?.signal ? { signal: opts.signal } : {}),
216 })
217 return Promise.resolve({
218 pid: -1, // Sprite exec sessions do not surface a host-visible pid.
219 stdout: stream.stdout,
220 stderr: stream.stderr,
221 stdin: {
222 write: () =>
223 Promise.reject(
224 new Error(
225 'sprites: background process stdin is not writable (see capabilities.writableStdin)',
226 ),
227 ),
228 end: () => Promise.resolve(),
229 },
230 wait: () => stream.wait(),
231 kill: () => stream.kill(),
232 })
233 }
234
235 private connectPort(port: number): Promise<SandboxChannel> {
236 if (port !== this.httpPort) {

Callers 1

constructorMethod · 0.95

Calls 5

absMethod · 0.95
mergedEnvMethod · 0.95
resolveMethod · 0.80
waitMethod · 0.80
execMethod · 0.65

Tested by

no test coverage detected