diff options
Diffstat (limited to 'git-annex.hs')
-rw-r--r-- | git-annex.hs | 39 |
1 files changed, 9 insertions, 30 deletions
diff --git a/git-annex.hs b/git-annex.hs index f1af0eea5..f2005e13e 100644 --- a/git-annex.hs +++ b/git-annex.hs @@ -19,9 +19,6 @@ import qualified Test #ifdef mingw32_HOST_OS import Utility.UserInfo import Utility.Env -import Config.Files -import System.Process -import System.Exit #endif main :: IO () @@ -33,7 +30,9 @@ main = do | isshell n = CmdLine.GitAnnexShell.run ps | otherwise = #ifdef mingw32_HOST_OS - winEnv gitannex ps + do + winEnv + gitannex ps #else gitannex ps #endif @@ -49,37 +48,17 @@ main = do #ifdef mingw32_HOST_OS {- On Windows, if HOME is not set, probe it and set it. - - This is a workaround for some Cygwin commands needing HOME to be set, - - and for there being no known way to set environment variables on - - Windows, except by passing an environment in each call to a program. - - While ugly, this workaround is easier than trying to ensure HOME is set - - in all calls to the affected programs. + - This is a workaround for some Cygwin commands needing HOME to be set. - - If TZ is set, unset it. - TZ being set can interfere with workarounds for Windows timezone - horribleness, and prevents getCurrentTimeZone from seeing the system - time zone. - - - - Due to Windows limitations, have to re-exec git-annex with the new - - environment. -} -winEnv :: ([String] -> IO ()) -> [String] -> IO () -winEnv a ps = do - e <- getEnvironment +winEnv :: IO () +winEnv = do home <- myHomeDir - let e' = wantedenv e home - if (e' /= e) - then do - cmd <- readProgramFile - (_, _, _, pid) <- createProcess (proc cmd ps) - { env = Just e' } - exitWith =<< waitForProcess pid - else a ps - where - wantedenv e home = delEntry "TZ" $ case lookup "HOME" e of - Nothing -> e - Just _ -> addEntries - [ ("HOME", home) - , ("CYGWIN", "nodosfilewarning") - ] e + setEnv "HOME" home False + setEnv "CYGWIN" "nodosfilewarning" True + unsetEnv "TZ" #endif |