Re: Proposal: overhaul System.Process

Brian Brunswick wrote:
On Tue, Apr 29, 2008 at 6:14 PM, Simon Marlow
wrote: readProcessWithExitCode :: FilePath -- ^ command to run -> [String] -- ^ any arguments -> String -- ^ standard input -> IO (ExitCode,String) -- ^ exitcode, and stdout + stderr
Surely in this case one wants stdout in a separate String to stderr?
If something fails in the middle of a long operation, I want just the error, doc!
Well yes, but maybe you also want to tally the stderr with the stdout, to see what was going on at the time the errors were generated (modulo buffering, of course). How about two separate versions? In which case, what should they be called? Cheers, Simon

Hi
Surely in this case one wants stdout in a separate String to stderr?
If something fails in the middle of a long operation, I want just the error, doc!
Sometimes what you want is the ordered sequence, so you can see which out message came just before the err message. You could just generalise to: IO (ExitCode, String, String, String) where ( _, out `intersperse` err, out, err) But that feels a little ugly
How about two separate versions? In which case, what should they be called?
The current proposal feels very good. You have the "I expect it to fail" and the "I expect it to succeed". If you introduce another variant, it suddenly becomes much less clear. Thanks Neil

On Tue, Apr 29, 2008 at 08:58:19PM +0100, Neil Mitchell wrote:
How about two separate versions? In which case, what should they be called?
The current proposal feels very good. You have the "I expect it to fail" and the "I expect it to succeed". If you introduce another variant, it suddenly becomes much less clear.
I agree. The only improvement I can think of is that it'd be nicer if the first function readProcess were to put stderr in the exception thrown, but there are reasons not to do that (e.g. if stderr is very long). In any case, these are pretty simple functions to implement in terms of createProcess (I think that was what it was called), and if there are less-simple "simple" functions that would be useful, they could always be implemented outside System.Process. -- David Roundy Department of Physics Oregon State University
participants (3)
-
David Roundy
-
Neil Mitchell
-
Simon Marlow