[darcs-users] Bug in Windows MSYS in Darcs 2.0.2

David Roundy daveroundy at gmail.com
Tue Jul 8 19:31:12 UTC 2008


This is odd.  I thought this code would work for windows.  Simon, do
you have any idea what's going wrong? Should threadWaitRead fail on
windows? Salvatore, what version of ghc is it that you're using?

David

On Tue, Jul 8, 2008 at 1:33 AM, Salvatore Insalaco <kirby81 at gmail.com> wrote:
> Darcs 2.0.2 introduced a Windows issue (not present in 2.0.1rc2) that
> makes darcs crash every time it prompts for something to the user.
>
> The issue is that darcs is compiled with "-threaded" by default, and
> in Utils.lhs there's:
> askUser :: String -> IO String
> askUser prompt = withThread $ withoutProgress $ do putStr prompt
>                                                   hFlush stdout
>                                                   threadWaitRead 0
> #ifndef WIN32
>                                                   getLine
> #else
>                                                   stripCr `fmap` getLine
> #endif
>
> Unfortunately threadWaitRead just crashes on windows msys when
> threaded RTS is used
> (http://hackage.haskell.org/trac/ghc/ticket/2408).
>
> The solution is pretty easy:
> askUser :: String -> IO String
> askUser prompt = withThread $ withoutProgress $ do putStr prompt
>                                                   hFlush stdout
> #ifndef WIN32
>                                                   threadWaitRead 0
>                                                   getLine
> #else
>                                                   stripCr `fmap` getLine
> #endif
>
> It would be even better to check just for msys, not WIN32 (I don't
> remember the define name at the moment).
>
> With this change I guess that windows users lose a bit of ctrl-c-ness,
> but at least it doesn't crash :).
>
> Salvatore
> _______________________________________________
> darcs-users mailing list
> darcs-users at darcs.net
> http://lists.osuosl.org/mailman/listinfo/darcs-users
>


More information about the darcs-users mailing list