Responding to the list..
I had this same problem a couple weeks ago when trying to install virthualenv and I don't really understand it got into a bad state, but the way I solved it was by fixing the locale settings on my gentoo machine so that I'm using UTF8. That just involved a few changes in /etc and then the problem went away.
On Sat, Aug 11, 2012 at 7:13 AM, Benjamin Edwards <edwards.benj@gmail.com> wrote:Hello café,I have a program that is crashing, and I have no idea why:module Mainwhereimport System.Process (readProcessWithExitCode)main :: IO ()main = do _ <- readProcessWithExitCode "ghc-pkg" ["describe", "hoopl"] ""putStrLn "Should never get here"this is using the process package from hackage. The program crashes withminimal-test: fd:5: hGetContents: invalid argument (invalid byte sequence)minimal-test: thread blocked indefinitely in an MVar operationinspecting the source of readProcessWithExitCode yields an obvious explanation to the MVar problem, but I don't understand why hGetContents is so offended.For the lazy it is defined as follows:readProcessWithExitCode:: FilePath -- ^ command to run-> [String] -- ^ any arguments-> String -- ^ standard input-> IO (ExitCode,String,String) -- ^ exitcode, stdout, stderrreadProcessWithExitCode cmd args input = do(Just inh, Just outh, Just errh, pid) <-createProcess (proc cmd args){ std_in = CreatePipe,std_out = CreatePipe,std_err = CreatePipe }outMVar <- newEmptyMVar-- fork off a thread to start consuming stdoutout <- hGetContents outh_ <- forkIO $ C.evaluate (length out) >> putMVar outMVar ()-- fork off a thread to start consuming stderrerr <- hGetContents errh_ <- forkIO $ C.evaluate (length err) >> putMVar outMVar ()-- now write and flush any inputwhen (not (null input)) $ do hPutStr inh input; hFlush inhhClose inh -- done with stdin-- wait on the outputtakeMVar outMVartakeMVar outMVarhClose outhhClose errh-- wait on the processex <- waitForProcess pidreturn (ex, out, err)Now having looked at the source of ghc-pkg it is dumping it's output using putStr and friends, so that should be using my local encoding on the system, right? and so should hGetContents in my program..?Now, for the curious: the reason I care is that this problem has effectively prevented me from using virthualenv. Sadness and woe._______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe