[Haskell-cafe] GHC throws IOError on Win32 when there is no console

Simon Peyton-Jones simonpj at microsoft.com
Mon Feb 19 11:28:47 EST 2007


Would it be worth opening a Trac bug report or feature request for this?  And/or documenting the unexpected behaviour; perhaps here http://haskell.org/haskellwiki/GHC/GUI_programming ?

Simon

| -----Original Message-----
| From: haskell-cafe-bounces at haskell.org [mailto:haskell-cafe-bounces at haskell.org] On Behalf Of Duncan
| Coutts
| Sent: 10 February 2007 11:57
| To: John Ky
| Cc: Haskell Cafe
| Subject: Re: [Haskell-cafe] GHC throws IOError on Win32 when there is no console
|
| On Sat, 2007-02-10 at 09:32 +1100, John Ky wrote:
| > Hi,
| >
| > I noticed on Windows that when I use IO functions that write to stdout
| > when the process is lacking a console, those functions throw an
| > IOError.  I'm not sure if this also occurs for stderr because I
| > haven't tried it.
| >
| > Some classes of processes are created without a console because they
| > never interact with the user and include System services.  Crashing
| > with IOError in this case is difficult to diagnose because because the
| > only symptom is the process crashes with no visible output.
| >
| > I believe the most sensible behaviour should be for those functions to
| > not throw, but instead do nothing.
|
| I brought this up some time ago with the GHC developers since it is a
| problem for Windows users who use Gtk2Hs and want to hide the console
| window. They felt that since this was the default system behaviour that
| it's best for GHC not to override that. C programs apparently suffer
| from the same problem (possibly depending on the variant of the C lib).
|
| The situation is much improved from when I originally complained about
| this. It does now at least display an message box with the error rather
| than silently terminating.
|
| If there is a reliable way to 'fix' the standard handles (as Paul Moore
| suggests) when running without a console then I could include that code
| into the Gtk2Hs startup and then make -optl-mwindows the default for
| progs compiled with Gtk2Hs.
|
| Duncan
|
| _______________________________________________
| Haskell-Cafe mailing list
| Haskell-Cafe at haskell.org
| http://www.haskell.org/mailman/listinfo/haskell-cafe


More information about the Haskell-Cafe mailing list