Proposal: overhaul System.Process
droundy at darcs.net
Wed Apr 23 14:58:48 EDT 2008
On Wed, Apr 23, 2008 at 11:29:42AM -0700, Simon Marlow wrote:
> So now we have:
> Prelude System.Process> readProcessMayFail "ls" ["/foo"] ""
> (ExitFailure 2,"ls: /foo: No such file or directory\n")
> Prelude System.Process> readProcess "ls" ["/foo"] ""
> *** Exception: readProcess: ls: failed
> Look ok?
Looks fine as an API. As an implementation, I'd prefer for the exception
thrown to include stderr (and wouldn't mind if the output didn't include
stderr). It'd be much nicer if we had:
Prelude System.Process> readProcess "ls" ["/foo"] ""
*** Exception: readProcess: ls /foo: No such file or directory
This would mean that correct programs could use readProcess without
sacrificing nice feedback when something unusual happens. Of course, we
can't guarantee that stderr will give any hint as to what went wrong, but
that's not our bug. We could also potentially include both stdout and
stderr, or just the last few lines of the stdout/stderr combination.
But it'd be nice to be able to use readProcess rather than being forced to
write our own in order to give better error messages to our users.
Department of Physics
Oregon State University
More information about the Libraries