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
On Sat, Oct 18, 2014 at 6:52 PM, Chris Angelico rosuav@gmail.com wrote:
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?
Any views on this feature? (I just rebased the branch on top of current 8.1, no other changes.) Fears of breakage? Interest in using it? Anything?
ChrisA
pike-devel@lists.lysator.liu.se