Skip to content

Search PATHEXT instead of 3 hardcoded values#290

Merged
ariporad merged 1 commit intoshelljs:masterfrom
dead-claudia:pathext
Jan 31, 2016
Merged

Search PATHEXT instead of 3 hardcoded values#290
ariporad merged 1 commit intoshelljs:masterfrom
dead-claudia:pathext

Conversation

@dead-claudia
Copy link
Copy Markdown

Redo of #134.

Since it was only a few lines, it was easy to rewrite against master.

src/which.js Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this line removed?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By accident.

@nfischer
Copy link
Copy Markdown
Member

@isiahmeadows could you generate-docs?

src/which.js Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to mentioned that WinXP lacks this thing in the comment. Also not sure if supporting Windows XP is a good idea. It is quite old and unsupported even by Microsoft.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see much harm in the default value. I agree that WinXP doesn't need to be supported by us, since the OS is end-of-life by Microsoft. However, just in case it's perhaps possible to delete environmental variables in Windows (is this even possible?), It'd be good to keep some fall-back value.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can delete environmental variables but if you delete this one I'm guessing shelljs would be the least of your problems :D

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still, a default value is a good fallback so we should keep it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ Good point. But yes, I also vote we keep it for no other reason than extra safety measure.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm clarifying the comment as it's a precautionary measure.

@BYK
Copy link
Copy Markdown
Contributor

BYK commented Jan 15, 2016

LGTM

FYI: Windows also has a built-in where command.

src/which.js Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally optional suggestion

Perhaps we don't need this much info in the README? The README is supposed to give a brief overview of commands, and this might be too much detail. I think it's sufficient to say something to the effect of "On Windows, this uses the PATHEXT environment variable to append the extension" here.

I think it's better to have this comment down below in the function body.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix.

@dead-claudia
Copy link
Copy Markdown
Author

Do note that I use Linux, my Windows installation is rather broken ATM, and my computer is too old/underpowered to run a VM, so I don't know how well this runs, and I kinda feel guilty not being able to test this. 😦

But feel free to test this yourself. I did add a test. It's also a trivial enough patch that it should work.

(@nfischer If you all got Appveyor to run for PRs as well, that'd be awesome, probably even for you, considering this supports Windows. 😉)

I submitted the original PR, #134, about 1 1/2 years ago, when my Windows installation actually worked (mine needs way more troubleshooting than I have time for ATM - my standard user directory requires Admin privileges to even read).

@nfischer
Copy link
Copy Markdown
Member

I'll test this out on my Windows machine today and see how it runs. Thanks again!

test/which.js Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typeo: s/node.exe/nodeExe

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops...will fix when I get home...

@nfischer
Copy link
Copy Markdown
Member

The nits are all totally optional. They're just for stylistic consistency (which we aren't very good at anyway, as you can probably see by other lines in this test that differ from the style I'm suggesting).

The big issue is the comment about case-insensitive comparison (and also see the typo I pointed out). Once that gets updated, I'll test again and give the thumbs up.

@ariporad ariporad added this to the v0.6.0 milestone Jan 24, 2016
@nfischer
Copy link
Copy Markdown
Member

@isiahmeadows Could you rebase this off master? We now have Windows CI set up with appveyor, and it'd be great to verify this under that (although I'm fairly certain it'll pass after the rebase).

@dead-claudia
Copy link
Copy Markdown
Author

I like that GitHub has this "Update Branch" button where I could do that here. 😄

@ariporad
Copy link
Copy Markdown
Contributor

What? They added such a button‽‽‽

Thanks! Ari
On Thu, Jan 28, 2016 at 3:38 PM, shelljs/shelljs
reply@reply.github.com
wrote:
I like that GitHub has this "Update Branch" button where I could do that here.:smile: [https://assets-cdn.github.com/images/icons/emoji/unicode/1f604.png]


Reply to this email directly or view it on GitHub
[https://github.com//pull/290#issuecomment-176482283] .[https://github.com/notifications/beacon/ABu7pJGYEXZGHWuh2J1oFc_U2wgsCAwAks5pep3-gaJpZM4HFNsu.gif]

@dead-claudia
Copy link
Copy Markdown
Author

That's what I just used. And it doesn't appear to be passing... I'll fix it when I get home. I've been a bit busy lately.

@dead-claudia
Copy link
Copy Markdown
Author

This latest push won't fix the build, but it'll give me a better idea what happened.

@dead-claudia
Copy link
Copy Markdown
Author

@nfischer It's surprising that the AppVeyor build isn't marked as required...I'm guessing that was an oversight? (I just noticed this.)

Redo of shelljs#134

`which` now searches through PATHEXT on Windows, and it also now does a
case-insensitive comparison. This better fits the Windows environment, where
the OS usually ignores case.
@dead-claudia
Copy link
Copy Markdown
Author

I've rebased against master to remove all the superflouous commits.

@dead-claudia
Copy link
Copy Markdown
Author

@ariporad I think this is a recent addition, where if you don't have merge conflicts, you can just update your remote branch through GitHub itself instead of locally having to do it. It's just like with merging branches.

@nfischer
Copy link
Copy Markdown
Member

Edit: just checked the code (and meant to hit cancel on this comment, not "close and comment". Looks like checkpath() works as expected. LGTM

@nfischer nfischer closed this Jan 29, 2016
@nfischer nfischer reopened this Jan 29, 2016
@nfischer
Copy link
Copy Markdown
Member

LGTM (in case lgtm.co missed it)

@nfischer nfischer assigned ariporad and unassigned nfischer Jan 30, 2016
ariporad added a commit that referenced this pull request Jan 31, 2016
feat(Windows): search PATHEXT instead of 3 hardcoded values
@ariporad ariporad merged commit a96467a into shelljs:master Jan 31, 2016
@ariporad
Copy link
Copy Markdown
Contributor

Thanks @isiahmeadows!

And yeah that was an oversight, At the time we added it, our windows build was broken.

@dead-claudia dead-claudia deleted the pathext branch February 2, 2016 15:12
@dead-claudia
Copy link
Copy Markdown
Author

@ariporad Okay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants