From 9b3dd1ba123a85220daf1daea7996a71cd251dca Mon Sep 17 00:00:00 2001
From: David Terei <davidterei@gmail.com>
Date: Fri, 18 Nov 2011 14:11:59 -0800
Subject: [PATCH] Update for recent mutable locale changes

---
 System/Process/Internals.hs | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/System/Process/Internals.hs b/System/Process/Internals.hs
index c805ad0e..2286d31a 100644
--- a/System/Process/Internals.hs
+++ b/System/Process/Internals.hs
@@ -417,12 +417,17 @@ pfdToHandle pfd mode = do
                        False {-is_socket-}
                        False {-non-blocking-}
   fD <- FD.setNonBlockingMode fD True -- see #3316
-  mkHandleFromFD fD fd_type filepath mode False{-is_socket-}
-                       (Just localeEncoding)
+  enc <- getLocaleEncoding
+  mkHandleFromFD fD fd_type filepath mode False {-is_socket-} (Just enc)
 #else
   fdToHandle' fd (Just Stream)
-     False{-Windows: not a socket,  Unix: don't set non-blocking-}
-     filepath mode True{-binary-}
+     False {-Windows: not a socket,  Unix: don't set non-blocking-}
+     filepath mode True {-binary-}
+#endif
+
+#if __GLASGOW_HASKELL__ < 703
+getLocaleEncoding :: IO TextEncoding
+getLocaleEncoding = return localEncoding
 #endif
 
 #ifndef __HUGS__
-- 
GitLab