Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

447 B
Raw Blame
import { CommandHandle, CommandExitError } from '../src/index.js'
import { assert } from 'vitest'

export function catchCmdExitErrorInBackground(cmd: CommandHandle) {
  let disabled = false

  cmd.wait().catch((res: CommandExitError) => {
    if (!disabled) {
      assert.equal(
        res.exitCode,
        0,
        `command failed with exit code ${res.exitCode}: ${res.stderr}`
      )
    }
  })

  return () => {
    disabled = true
  }
}