Skip to content

Commit

Permalink
Fix #3992 Windows 10: Work around upstream git clone issue (#4121)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilgrem authored and isovector committed Jun 29, 2018
1 parent 417162d commit d444a80
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Stack/Upgrade.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
Expand All @@ -24,6 +24,10 @@ import Path
import qualified Paths_stack as Paths
import Stack.Build
import Stack.Config
-- Following import is redundant on non-Windows operating systems
#ifdef WINDOWS
import Stack.DefaultColorWhen (defaultColorWhen)
#endif
import Stack.Fetch
import Stack.PackageIndex
import Stack.PrettyPrint
Expand Down Expand Up @@ -212,6 +216,13 @@ sourceUpgrade gConfigMonoid mresolver builtHash (SourceOpts gitRepo) =
-- --git" not working for earlier versions.
let args = [ "clone", repo , "stack", "--depth", "1", "--recursive", "--branch", branch]
withWorkingDir (toFilePath tmp) $ proc "git" args runProcess_
#ifdef WINDOWS
-- On Windows 10, an upstream issue with the `git clone` command
-- means that command clears, but does not then restore, the
-- ENABLE_VIRTUAL_TERMINAL_PROCESSING flag for native terminals.
-- The folowing hack re-enables the lost ANSI-capability.
_ <- liftIO defaultColorWhen
#endif
return $ Just $ tmp </> $(mkRelDir "stack")
Nothing -> do
updateAllIndices
Expand Down

0 comments on commit d444a80

Please sign in to comment.