RE: [Haskell-cafe] making the GHC Api not write to stderr

2010-05-22 Thread Phyx
I did some more digging around and it would seem that the error was being printed from the load call (depanal does some parsing ofcourse to find the imports). I managed to silence that using loadWithLogger (const $ return ()) LoadAllTargets (maybe all these loggers should be consolidated).

RE: [Haskell-cafe] making the GHC Api not write to stderr

2010-05-22 Thread Phyx
Right, that modulename was being printed due to a trace statement in my code, so I’m now using withLocalCallbacks (\_ - GhcApiCallbacks (\_ _ - return ())) $ To override everything along with setting log_action to (\_ _ _ _ - return ()). Now nothing else gets printed J Thanks for all the

Re: [Haskell-cafe] making the GHC Api not write to stderr

2010-05-21 Thread Thomas Schilling
You could try changing the log_action[1] member of the DynFlags. A while ago I turned most printed errors into some form of error message, but I wouldn't be surprised if I missed some places. All output should go through log_action, though, so try changing that to intercept any output. [1]:

RE: [Haskell-cafe] making the GHC Api not write to stderr

2010-05-21 Thread Phyx
Hi, I tried that, setting it to (\_ _ _ _ - return ()) and it still did the same, also tried setting it to undefined to see whether the code that's printing the error is using it, and it didn't crash So I assume it's not. --- *VsxParser getModInfo True

Re: [Haskell-cafe] making the GHC Api not write to stderr

2010-05-21 Thread Daniel Peebles
Have you tried freopen on stderr? On Fri, May 21, 2010 at 8:43 AM, Phyx loneti...@gmail.com wrote: Hi, I tried that, setting it to (\_ _ _ _ - return ()) and it still did the same, also tried setting it to undefined to see whether the code that's printing the error is using it, and it didn't

[Haskell-cafe] making the GHC Api not write to stderr

2010-05-20 Thread Phyx
I was wondering how to forcibly quiet down the API. I have a custom handler in place, but when I call the function on failure both my handler gets called and somewhere somehow errors get printed to the stderr, which I really need to avoid. My current code looks like getModInfo :: Bool -

Re: [Haskell-cafe] making the GHC Api not write to stderr

2010-05-20 Thread Martin Hilbig
hi, i tried this too, but i did not get it. a very nice workaround is to use hint [1]. have fun martin [1]: http://hackage.haskell.org/package/hint On 20.05.2010 20:05, Phyx wrote: I was wondering how to forcibly quiet down the API. I have a custom handler in place, but when I call the

RE: [Haskell-cafe] making the GHC Api not write to stderr

2010-05-20 Thread Phyx
I've thought about that, but my specific problem is that I'm calling the Haskell code compiled to a shared lib and then hPutStr is failing, presumable because there is no valid stderr (and I would image also no stdin or out). So in order for me to use that method I would have to create a new file

RE: [Haskell-cafe] making the GHC Api not write to stderr

2010-05-20 Thread Phyx
Hi, Unfortunately hint does not provide the functionality I require, and from what I remember about hint they also use the GHC API, I guess the problem here is the defaultErrorhandlers that is in initGhcMonad . I've been wondering if I give my own implementation, one that doesn't do any printing