Files
cloud-code/claude-code-source/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/which.js
janlaywss a192e187e8 fix: keep only source-map extracted node_modules, exclude pnpm artifacts
Restore node_modules to exact state from cli.js.map extraction:
- Move .ignored/ and .ignored_* files back to original package paths
- Remove pnpm symlinks (replaced by real source-map directories)
- Update .gitignore: only exclude /dist/, .pnpm/, .bin/, .ignored* dirs
- All package dist/ folders are now preserved as part of source-map files

After clone, run `pnpm install` to get pnpm-managed symlinks for building.
The committed node_modules contains the original TypeScript/JS source files
as bundled in cli.js.
2026-03-31 21:09:32 +08:00

25 lines
820 B
JavaScript

import { spawnSync } from 'node:child_process';
/**
* Find the path to an executable, similar to the `which` command.
* Uses Bun.which when running in Bun, falls back to spawnSync for Node.js.
*
* @param bin - The name of the executable to find
* @returns The full path to the executable, or null if not found
*/
export function whichSync(bin) {
// Check if we're running in Bun
if (typeof globalThis.Bun !== 'undefined') {
return globalThis.Bun.which(bin);
}
// Fallback to Node.js implementation
const result = spawnSync('which', [bin], {
encoding: 'utf8',
stdio: ['ignore', 'pipe', 'ignore'],
timeout: 1000,
});
if (result.status === 0 && result.stdout) {
return result.stdout.trim();
}
return null;
}
//# sourceMappingURL=which.js.map