property
Spawn.SpawnOptions.lazy
lazy?: boolean
If true, the stdout and stderr pipes don't automatically start reading data. Reading begins only when you access the stdout or stderr properties.
This can improve performance when you don't need to read output immediately.
const subprocess = Bun.spawn({
cmd: ["echo", "hello"],
lazy: true, // Don't start reading stdout until accessed
});
// stdout reading hasn't started yet
await subprocess.stdout.text(); // Now reading starts