Runs a command asynchronously and returns stdout, stderr, and exit code. Unlike captureOutput, this function does NOT throw on non-zero exit codes.
Command to be executed.
Arguments to pass to the command.
Optional
Optional settings for how to run the command.
A promise that resolves with stdout, stderr, and exitCode.
const result = await captureOutputWithExitCode('ls', ['-la'])if (result.exitCode !== 0) \{ console.error('Command failed:', result.stderr)\} Copy
const result = await captureOutputWithExitCode('ls', ['-la'])if (result.exitCode !== 0) \{ console.error('Command failed:', result.stderr)\}
Runs a command asynchronously and returns stdout, stderr, and exit code. Unlike captureOutput, this function does NOT throw on non-zero exit codes.