function
bun.spawnSync
function spawnSync<In extends Writable = 'ignore', Out extends Readable = 'pipe', Err extends Readable = 'pipe'>(
cmds: string[],
Synchronously spawn a new process
const {stdout} = Bun.spawnSync(["echo", "hello"]);
console.log(stdout.toString()); // "hello\n"Internally, this uses posix_spawn(2)
@param cmds
The command to run
The first argument is resolved to an absolute executable path. It must be a file, not a directory.
If you explicitly set PATH in env, that PATH is used to resolve the executable instead of the default PATH.
To check if the command exists before running it, use Bun.which(bin).