[Haskell-cafe] Standard output of exec

Michael Snoyman michael at snoyman.com
Thu Dec 11 17:48:33 UTC 2014

On Thu Dec 11 2014 at 7:10:51 PM Donn Cave <donn at avvanta.com> wrote:

> On Thu, Dec 11, 2014 at 10:18 AM, Michael Snoyman <michael at snoyman.com>
> wrote:
> > You can use readProcess[1], but it has some downsides:
> >
> > 1. Can't specify all options to CreateProcess, e.g., working directory
> and
> > environment variables.
> >
> > 2. Relies on lazy I/O
> I sure feel a pall of dread at the words "lazy I/O", but in this case,
> readProcess takes the curse off it by evaluating the output, am I right?
> Hence the repeated assurances in the documentation that it's strict.
I honestly don't know if the "curse" has been lifted in this case. It could
be that readProcess is perfectly safe and (unlike hGetContents) doesn't
have dangerous corner cases. I'm not certain.

One other issue that I forgot to mention though is that you're required by
the readProcess API to deal with the output from the process as textual
data, which is often times not appropriate. And given how complicated the
internals of readProcess are, it's highly unlikely someone would get that
right on their first attempt to port the code to use ByteString.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20141211/6fa979ad/attachment.html>

More information about the Haskell-Cafe mailing list