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

Shelly cannot see PATH… because on Windows it may be named Path #110

Open
mwu-tow opened this issue Oct 1, 2015 · 1 comment
Open
Labels
os: windows path Issues with the system PATH

Comments

@mwu-tow
Copy link

mwu-tow commented Oct 1, 2015

Please consider the following program:

{-# LANGUAGE OverloadedStrings #-}

import qualified Shelly as Sh
import qualified System.Environment as Env

main :: IO ()
main = do
    print "PATH according to Shelly"
    (Sh.shelly $ Sh.get_env "PATH") >>= print
    print "PATH according to System.Environment"
    Env.getEnv "PATH" >>= print 

I'd expect that results of both Sh.get_env "PATH" and Env.getEnv "PATH" are the same (modulo Maybe), however to my surprise they are not.

H:\shelly>stack ghc Test.hs && test
Run from outside a project, using implicit global config
Using resolver: lts-3.5 from global config file: C:\s\global\stack.yaml
Continuing despite missing tool: msys2
[1 of 1] Compiling Main             ( Test.hs, Test.o )
Linking Test.exe ...
"PATH according to Shelly"
Nothing
"PATH according to System.Environment"
"C:\\CUDA\\Toolkit\\bin;C:\\CUDA\\Toolkit\\libnvvp;C:\\thingsInPath;C:\\Python27\\;C:\\Python27\\Scripts;C:\\Perl64\\site\\bin;C:\\Perl64\\bin;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Users\\mwurb_000\\AppData\\Roaming\\cabal\\bin;C:\\Program Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS Client\\;C:\\Program Files (x86)\\Git\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit\\;C:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn\\;C:\\Program Files (x86)\\Microsoft SDKs\\TypeScript\\1.0\\;C:\\Program Files (x86)\\CMake\\bin;C:\\Program Files (x86)\\QuickTime\\QTSystem\\;C:\\Program Files\\Microsoft SQL Server\\120\\Tools\\Binn\\;C:\\Program Files (x86)\\Subversion\\bin;C:\\Program Files (x86)\\Skype\\Phone\\;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files\\TortoiseGit\\bin;C:\\Program Files\\OpenVPN\\bin;C:\\Users\\mwurb_000\\AppData\\Local\\Programs\\minghc-7.8.4-x86_64\\switch;C:\\Ruby21-x64\\bin;C:\\Users\\mwurb_000\\AppData\\Local\\atom\\bin;C:\\ProgramData\\chocolatey\\bin;"

After some more experiments I think I got why Shelly cannot get PATH. On my Windows machine this environment variable is named Path. Apparently Shelly's get_env is case-sensitive. It should not be.
Because of that not only getting the environment fails but it also breaks functions like which.

@gregwebs
Copy link
Owner

gregwebs commented Oct 2, 2015

Thanks for reporting. Looks like for Window shelly needs to use the case-insensitive package (or perhaps toLower)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os: windows path Issues with the system PATH
Projects
None yet
Development

No branches or pull requests

3 participants