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

Relative paths stopped working #33

Closed
satazor opened this issue May 18, 2016 · 9 comments
Closed

Relative paths stopped working #33

satazor opened this issue May 18, 2016 · 9 comments

Comments

@satazor
Copy link

satazor commented May 18, 2016

I got a bug report in cross-spawn-async related to relative paths not working correctly. After investigation, which changed handling of relative paths in 1.2.5. The same test when using which@1.2.4 passes. As a workaround, if I do path.resolve before calling which it works correctly.

I will add a test case if necessary.

@isaacs
Copy link
Contributor

isaacs commented May 18, 2016

Well that's weird, because 1.2.5 was supposed to fix handling of relative paths. I'll dig in soon.

@isaacs
Copy link
Contributor

isaacs commented May 18, 2016

Feel free to send a PR (or just paste an example) with a failing test case.

isaacs added a commit that referenced this issue May 18, 2016
@isaacs
Copy link
Contributor

isaacs commented May 18, 2016

@satazor Can you try npm i npm/node-which#fix-relative-more and see if that fixes the issue?

@satazor
Copy link
Author

satazor commented May 18, 2016

@isaacs when I arrive home I will try it out!

@satazor
Copy link
Author

satazor commented May 18, 2016

@isaacs I confirm that fix-relative-more branch is working correctly!

@isaacs
Copy link
Contributor

isaacs commented May 18, 2016

@satazor \o/ Awesome. I'll add a test and try to get this shipped soon.

@isaacs isaacs closed this as completed in f3bfeda May 18, 2016
@satazor
Copy link
Author

satazor commented May 18, 2016

gj

@okonet
Copy link

okonet commented Dec 19, 2016

Not sure if this is related issue, but I see some inconsistency in how which and this modules works:

 ...Projects/OSS/sort-staged-example    master ✘ ✹ ✚   $ which ./front/postcss/sort         
./front/postcss/sort

 ...Projects/OSS/sort-staged-example    master ✘ ✹ ✚   $ node bin/which ./front/postcss/sort 
module.js:457
    throw err;
    ^

Error: Cannot find module '/Users/okonet/Projects/OSS/sort-staged-example/bin/which'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.runMain (module.js:590:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

@isaacs
Copy link
Contributor

isaacs commented Dec 20, 2016

@okonet That's not a problem with this code, it's a problem when the way you're trying to invoke it. Observe:

$ cat ./front/postcss/sort
echo ok

$ ls -laF ./front/postcss/sort
-rwxr-xr-x  1 isaacs  staff  8 Dec 19 15:16 ./front/postcss/sort*

$ ./front/postcss/sort
ok

$ which ./front/postcss/sort
./front/postcss/sort

$ npm i which -S
x@3.0.0 /Users/isaacs/dev/js/x
└── which@1.2.12

$ node node_modules/.bin/which ./front/postcss/sort
./front/postcss/sort

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

3 participants