Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It does not find executable by relatative path on Linux #29

Closed
JustBlackBird opened this issue Apr 7, 2016 · 2 comments
Closed

It does not find executable by relatative path on Linux #29

JustBlackBird opened this issue Apr 7, 2016 · 2 comments

Comments

@JustBlackBird
Copy link
Contributor

At the moment, the library does not find an executable specified with relative path. For example:

require('which')('./test/foo.sh', function(err) {
    if (err) {
        throw err;
    }
})

ends up with "not found" error even if the file is there and has correct execution permissions. The same works fine on windows.

Standard Linux which utility works fine in such cases.

Is search order used in Linux which utility is documented somewhere?

@JustBlackBird JustBlackBird changed the title It does not find relatative path on Linux It does not find executable by relatative path on Linux Apr 7, 2016
@JustBlackBird
Copy link
Contributor Author

I've found sources of Debian which command. In that sources all input paths with at least one slash (/) are treated as relative ones. For such files values from PATH environment variable are not used.

The same behavior is described in COMMAND EXECUTION section of man bash (which is referenced by man which for search algorithm).

Should node-which works in the same way?

@JustBlackBird
Copy link
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant