GHCi 6.12.3 stdout redirection works for :type, but not for :info
claus.reinke at talk21.com
Mon Sep 20 12:43:20 EDT 2010
Dear GHCi / IO experts,
I'm encountering some odd GHCi behaviour with some
old ghci.conf code of mine (used to work in older GHCis).
The problem is that my code for redirecting the output
of GHCi commands still works for things like :type, but
no longer for things like :info (this is my smallest example
demonstrating the effect).
With the attached GHCi script defining a
:redir <var> <command>
command that should redirect the ouput of <command>
into variable <var>, we get the output appended below
(note the Exception for WriteConsole "handle is invalid",
which is written into the temporary file when :info is
called while stdout is redirected to that temporary file;
in other words, the error message appears where the
output of the command fails to appear).
Is that an expected change with a known workaround,
so that I just need to update my code, or is that
unexpected behaviour that can only be fixed in GHCi?
PS. This is on Windows 7, if that matters.
------------- example session output
$ ghcii.sh -ignore-dot-ghci
GHCi, version 6.12.3: http://www.haskell.org/ghc/ :? for help
Prelude> :cmd readFile "redir.script"
Prelude> :redir x :t map
"-- logging GHCi stdout\nmap :: (a -> b) -> [a] -> [b]\n"
Prelude> :redir y :i map
"-- logging GHCi stdout\n*** Exception: WriteConsole: invalid argument (Das
Handle ist ung\252ltig.)\n"
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 843 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20100920/757e3377/redir.obj
More information about the Glasgow-haskell-users