-
Notifications
You must be signed in to change notification settings - Fork 54
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
Fix augment path #237
Fix augment path #237
Conversation
b2d676a
to
3cd36c7
Compare
On windows, env vars are generally case-insensitive. Due to 'type EnvVars = Map Text Text' augmentPathMap assumes full uppercase "PATH" variable, which may lead to surprising behavior if the current map has a variable such as "Path". This patch folds over the map and inserts any path key as "PATH" on windows. That also means: if there are multiple, the "last" one wins. There generally isn't a sane solution if the input map already has multiple path keys (how should they be merged, which order?). Fixes commercialhaskell#234
3cd36c7
to
f62145e
Compare
-- Default value for PATHTEXT on Windows versions after Windows XP. (The | ||
-- documentation of the default at | ||
-- https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/start | ||
-- is incomplete.) | ||
defaultPATHEXT = ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC" | ||
|
||
|
||
-- Fix case insensitivity of the PATH environment variable on Windows, | ||
-- by forcing all keys full uppercase. | ||
normalizePathEnv :: EnvVars -> EnvVars |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not entirely sure if we need an inline pragma here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's reasonable as-is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I'll merge/release once CI passes. Thanks!
-- Default value for PATHTEXT on Windows versions after Windows XP. (The | ||
-- documentation of the default at | ||
-- https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/start | ||
-- is incomplete.) | ||
defaultPATHEXT = ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC" | ||
|
||
|
||
-- Fix case insensitivity of the PATH environment variable on Windows, | ||
-- by forcing all keys full uppercase. | ||
normalizePathEnv :: EnvVars -> EnvVars |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's reasonable as-is.
Released to Hackage, thanks! |
I'll open a PR against Stack to use this newer version, unless you'd like to open that PR instead. |
On windows, env vars are generally case-insensitive.
Due to 'type EnvVars = Map Text Text' augmentPathMap
assumes full uppercase "PATH" variable, which may lead
to surprising behavior if the current map
has a variable such as "Path".
This patch folds over the map and inserts any path
key as "PATH" on windows. That also means: if there
are multiple, the "last" one wins. There generally
isn't a sane solution if the input map already
has multiple path keys (how should they be merged,
which order?).
Fixes #234