I periodically find myself needing something similar to Process.run(),
but processing intermediate output. Example:

https://github.com/Rosuav/FrozenOST/blob/master/build.pike#L114

It needs to take whatever's sent to stderr, turn all \n into \r, and
send it on to the real stdout. (Yes, it sends stderr to stdout.) I
usually end up lifting the code of Process.run() and making a cut-down
version (as I don't need all its features); but the obvious
alternative would be to have Process.run itself provide this facility.

The code is now at branch rosuav/process_run_with_func; the equivalent
to my above code would be simply:

Process.run(({"sox","-S","-m","-v",".5"})+tracklist/1*({"-v",".5"})+({soundtrack}),
    (["stderr":lambda(string data) {write(replace(data,"\n","\r"));}]));

Is this a feature worth adding?

ChrisA

Reply via email to