Suggested new function for System.Process - robustReadProcessWithExitCode

Simon Marlow marlowsd at gmail.com
Wed Jan 5 16:14:17 CET 2011


On 17/12/2010 04:09, Andrew Miller wrote:
> Hi,
>
> I include my proposal for a new function, for System.Process ,
> robustReadProcessWithExitCode, below.
>
> Best wishes,
> Andrew Miller
>
> Motivation for change: using readProcessWithExitCode risks terminating
> the program due to uncaught IOException (ResourceExhausted) if the input
> string is not read entirely by the new process before the new process
> exits, because readProcessWithExitCode will attempt to write to a
> process that doesn't exist.
>
> Often, it is the exit code and standard input and standard error that
> matters to a programmer, and not whether a process read all the input.
> There is therefore a case for a function like readProcessWithExitCode
> which is robust to the new process exiting before all input is read.

Perhaps this should be the default behaviour of readProcessWithExitCode? 
  Or perhaps it should return (Maybe IOException) representing any 
exception caught while sending input to the process?

I'm not too keen on the name "robustReadProcessWithExitCode", it's not 
clear what "robust" refers to.

Cheers,
	Simon



More information about the Libraries mailing list