Package Exports
- lookpath
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (lookpath) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
lookpath
To check if the command exists and where the executable file is.
const { lookpath } = require('lookpath');
const p = await lookpath('bash');
// "/bin/bash", otherwise "undefined"Install
npm install lookpathBackground
- I DON'T want to spawn
child_processJUST in order to kickwhich,where,whereis, orcommand -v. - I checked Go implementation of
exec.LookPath. - I concluded that scanning under
$PATHor$Pathis the best straightforward way to check if the command exists.
Issues
Any feedback would be appreciated ;)