You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into an issue where i had a directory in my path which contained a subdirectory. While using which to find an actual executable, it returned the path to the directory instead since it was first in the path:
➜ which ls -l
total 0
drwxr-xr-x 2 ptierno staff 68 Aug 25 19:02 directory
➜ which export PATH=`pwd`:$PATH
➜ which node
> var which = require('which');
undefined
>
> which.sync('directory')
'/Users/ptierno/which/directory'
If I remove the executable bit from the directory then the directory doesnt get returned (which is what I would expect).
➜ which chmod -x directory
➜ which node
> var which = require('which');
undefined
> which.sync('directory')
Error: not found: directory
at getNotFoundError (/Users/ptierno/node_modules/which/which.js:14:12)
at Function.whichSync [as sync] (/Users/ptierno/node_modules/which/which.js:132:9)
at repl:1:7
at REPLServer.defaultEval (repl.js:272:27)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.<anonymous> (repl.js:441:10)
at emitOne (events.js:101:20)
at REPLServer.emit (events.js:188:7)
at REPLServer.Interface._onLine (readline.js:224:10)
>
Might be a good idea to do a check to ensure the value being returned is an actual executable file and not a directory.
The text was updated successfully, but these errors were encountered:
I ran into an issue where i had a directory in my path which contained a subdirectory. While using which to find an actual executable, it returned the path to the directory instead since it was first in the path:
If I remove the executable bit from the directory then the directory doesnt get returned (which is what I would expect).
Might be a good idea to do a check to ensure the value being returned is an actual executable file and not a directory.
The text was updated successfully, but these errors were encountered: