Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

Ignore the PATH fix if it is not set #1437

Merged
merged 4 commits into from
Nov 7, 2019
Merged

Conversation

jneira
Copy link
Member

@jneira jneira commented Nov 6, 2019

@jneira jneira requested a review from samuelpilz November 6, 2019 11:07
install/src/Stack.hs Outdated Show resolved Hide resolved
Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

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

Maybe adding a log message may be interesting.

@fendor
Copy link
Collaborator

fendor commented Nov 6, 2019

In #1436 (comment) it is said that the path is set. Maybe dont merge this until it is clear why this issue arises?

Copy link
Contributor

@samuelpilz samuelpilz left a comment

Choose a reason for hiding this comment

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

Is catching an exception the best way to detect if the environment variable is set? This seems a bit hacky to me, but I have no experience with the System.Environment module

@jneira
Copy link
Member Author

jneira commented Nov 6, 2019

In #1436 (comment) it is said that the path is set. Maybe dont merge this until it is clear why this issue arises?

Sure, but i think the actual code does what i expected in the first place (return Nothing if the var is not informed)

Is catching an exception the best way to detect if the environment variable is set? This seems a bit hacky to me, but I have no experience with the System.Environment module

It was a surprise to me that lookupEnv throws an Exception instead return Nothing if the variable is not set (why return Maybe String then?)

The docs for lookupEnv states:

For POSIX users, this is equivalent to getEnv.

...and getenv trhows an IOException if the variable is not set 🤦‍♂

@fendor
Copy link
Collaborator

fendor commented Nov 6, 2019

...and getenv trhows an IOException if the variable is not set 🤦‍♂

then the patch makes sense. Maybe we should only catch exceptions that satisfy the predicate isDoesNotExistError? Otherwise, this PR is good to go.

@fendor
Copy link
Collaborator

fendor commented Nov 6, 2019

@jneira Merge when you are ready!

Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

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

That looks great! Thank you!

@jneira jneira merged commit c253cbb into haskell:master Nov 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

stack ./install.hs stack-install-cabal failed
3 participants