[Haskell-beginners] how to save the GHC errormessages in a file on Windows

Daniel Fischer daniel.is.fischer at googlemail.com
Thu Apr 28 15:04:18 CEST 2011


On Thursday 28 April 2011 14:31:29, Kees Bleijenberg wrote:
> When I try in Windows in cmd: ghc --make myprogram.hs > test.txt I only
> get the first lines in test.txt. The errormessages itself are on the
> screen, not in test.txt.
> 
> In test.txt:
> Resolving dependencies...
> Configuring ftphs-1.0.7...
> Preprocessing library ftphs-1.0.7...
> Preprocessing executables for ftphs-1.0.7...
> Building ftphs-1.0.7...
> 
> The errormessages: Could not find  module 'Network.FTP.Client'.... and a
> lot more.
> 
> How do I 'intercept' these messages?

The error messages are printed to stderr, while the others are printed to 
stdout. I'm not sure how it works on Windows, but on unix or linux, you'd 
redirect stderr with

$ command 2> file.txt

It's worth a try on Windows too, I think.

> 
> Kees



More information about the Beginners mailing list