On Mon, Apr 27, 2015 at 12:39:15PM -0700, enh wrote: > >> plus there's the question of whether giving up because you're writing > >> to a broken pipe is an error exit or not. you could add a special case > >> to xwrite (and add xprintf and xputs and...), but since the whole idea > >> is that code shouldn't have to care, it's easier just to install a > >> signal handler that does _exit(0). > > > > There are xputs and xprintf already. > > > > Calling _exit() is wrong for toybox, since you cannot use atexit() > > type code (eg, delete tempfiles on exit) - xexit() is the recommended > > path for toybox. > > Using a fixed return value is wrong; for an example, grep returns > > 0 for "line matched", 1 for "no match", and >1 for errors. > > (GNU grep 2.16 thinks grep should just die with SIGPIPE.)
I'm perfectly fine with any result that's properly distinguishable from result code with defined meanings -- especially 0 (success) and in the case of grep 1 (successful run with no match). It's probably wrong for Android to be treating SIGPIPE as a crash to begin with. Rich _______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
