Spawn a subprocess, and get buffered output
Deno Sandbox provides a sandboxed Linux microVM. This is useful for evaluating code that is not trusted or for testing code that is not safe to run in your main runtime.
You can spawn subprocesses in a sandbox and get buffered output. For example, to print the current working directory as seen below. This is useful for running shell commands and scripts.
import { Sandbox } from "@deno/sandbox";
await using sandbox = await Sandbox.create();
const cwd = await sandbox.sh`pwd`;
For long‑running processes or large output, stream the stdout/stderr instead of buffering it all in memory.
For more information, see the Deno Sandbox documentation.