From 61dae3ca1275ef360014165a4a0742e9f9059daa Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Tue, 2 Oct 2018 00:16:24 +0100 Subject: [PATCH] Fix #3797 (Windows 10: re `git submodule` usage) Commit 8bda49d9bd6030920a6c23aa82fcc98b6cd8137b introduced the `git submodule` command into `Pantry.Repo.getRepo'`. Tests suggest that, on Windows 10, this suffers from the same upstream bug as `git clone` (see https://github.com/commercialhaskell/stack/issues/3992#issuecomment-401207463 .) This pull request proposes the same 'fix'; on Windows 10, re-enable ANSI capability after the `git submodule` command is used. Tests on Windows 10 suggest the fix works as intended. --- subs/pantry/src/Pantry/Repo.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/subs/pantry/src/Pantry/Repo.hs b/subs/pantry/src/Pantry/Repo.hs index c93cc876c9..77a6997266 100644 --- a/subs/pantry/src/Pantry/Repo.hs +++ b/subs/pantry/src/Pantry/Repo.hs @@ -101,6 +101,11 @@ getRepo' repo@(Repo url commit repoType' subdir) pm = withWorkingDir dir $ do runCommand resetArgs traverse_ runCommand submoduleArgs + -- On Windows 10, an upstream issue with the `git submodule` 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. + when osIsWindows $ void $ liftIO $ hSupportsANSIWithoutEmulation stdout runCommand archiveArgs abs' <- resolveFile' tarball getArchive