Description
The built-in which command in command-stream returns a non-zero exit code even when the command exists in the system PATH.
Steps to Reproduce
- Install
gh CLI tool (GitHub CLI) on macOS via Homebrew
- Verify
gh is available by running gh --version in terminal (works)
- Use command-stream's built-in
which command:
import { $ } from 'command-stream';
const result = await $`which gh`;
console.log(result.code); // Returns non-zero even though gh exists
Expected Behavior
The built-in which command should return exit code 0 when the command is found in PATH.
Actual Behavior
Returns non-zero exit code, incorrectly indicating the command doesn't exist.
Environment
- OS: macOS (Darwin 24.5.0)
- command-stream version: latest
- Node.js/Bun version: Bun
Workaround
Using the system's which command or checking with --version flag works:
// This works correctly
await sh('gh --version', { mirror: false });
Additional Context
The gh command is installed at /opt/homebrew/bin/gh and is accessible from the terminal. Other built-in commands may have similar issues with PATH resolution on macOS systems with Homebrew.
Description
The built-in
whichcommand in command-stream returns a non-zero exit code even when the command exists in the system PATH.Steps to Reproduce
ghCLI tool (GitHub CLI) on macOS via Homebrewghis available by runninggh --versionin terminal (works)whichcommand:Expected Behavior
The built-in
whichcommand should return exit code 0 when the command is found in PATH.Actual Behavior
Returns non-zero exit code, incorrectly indicating the command doesn't exist.
Environment
Workaround
Using the system's
whichcommand or checking with--versionflag works:Additional Context
The
ghcommand is installed at/opt/homebrew/bin/ghand is accessible from the terminal. Other built-in commands may have similar issues with PATH resolution on macOS systems with Homebrew.