the universal sandbox runtime for agents and humans. pocketenv.io
sandbox openclaw agent claude-code vercel-sandbox deno-sandbox cloudflare-sandbox atproto sprites daytona
7
fork

Configure Feed

Select the types of activity you want to include in your feed.

Propagate command failures and unwrap exec errors

Log failed sandbox commands with consola.warn including stdout/stderr
and throw when exitCode !== 0. In the Sprite provider, catch
@fly/sprites ExecError and return its result so callers receive the
command result instead of throwing.

+14 -3
+5 -1
apps/sandbox/src/lib/prepare-sandbox.ts
··· 21 21 import chalk from "chalk"; 22 22 import { BaseSandbox } from "../providers/mod.ts"; 23 23 import { Preset, PresetSchema } from "../types/preset.ts"; 24 + import consola from "consola"; 24 25 25 26 const presets: Record<string, string> = { 26 27 amp, ··· 78 79 79 80 for (const line of item.run.trim().split("\n")) { 80 81 console.log(`${chalk.rgb(100, 232, 130)("exec")} ${line}`); 81 - await sandbox.sh`${line}`; 82 + const result = await sandbox.sh`${line}`; 83 + if (result.exitCode !== 0) { 84 + consola.warn(`Command "${chalk.rgb(100, 232, 130)(line)}" failed with exit code ${result.exitCode} ${result.stderr} ${result.stdout}.`); 85 + throw new Error(`Command "${line}" failed with exit code ${result.exitCode}`); 82 86 } 83 87 } 84 88 }
+9 -2
apps/sandbox/src/providers/sprites/mod.ts
··· 1 1 import BaseProvider, { BaseSandbox, SandboxOptions } from "../mod.ts"; 2 2 import process, { env } from "node:process"; 3 3 import consola from "consola"; 4 - import { Sprite, SpritesClient } from "@fly/sprites"; 4 + import { ExecError, Sprite, SpritesClient } from "@fly/sprites"; 5 5 import path from "node:path"; 6 6 import { Buffer } from "node:buffer"; 7 7 import crypto from "node:crypto"; ··· 45 45 const command = strings.reduce((acc, str, i) => { 46 46 return acc + str + (values[i] || ""); 47 47 }, ""); 48 - return this.sprite.execFile("bash", ["-c", command]); 48 + try { 49 + return await this.sprite.execFile("bash", ["-c", command]); 50 + } catch (e) { 51 + if (e instanceof ExecError) { 52 + return e.result; 53 + } 54 + throw e; 55 + } 49 56 } 50 57 51 58 id(): Promise<string | null> {