turning ExitCode into an IO exception

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

turning ExitCode into an IO exception

Henning Thielemann

Is there a prefered way to convert an ExitCode to an IO exception? When
running a sequence of IO actions, it is certainly best to use the same way
of showing failure for all of them. However running shell commands with
functions from the 'process' package shows failure by ExitCode which is
different from almost all other IO actions in 'base'.
_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: turning ExitCode into an IO exception

Max Bolingbroke-2
On 10 May 2010 21:02, Henning Thielemann <[hidden email]> wrote:
>
> Is there a prefered way to convert an ExitCode to an IO exception?

The most direct way would be to use exitWith, though it feels a bit
weird: http://haskell.org/ghc/docs/6.12.1/html/libraries/base-4.2.0.0/System-Exit.html#v:exitWith

This may not be suitable if you want to be able to make exitWith calls
of your own, because you won't be able to tell the exceptions apart.

Cheers,
Max
_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries