yeah, i've wanted similar in the past. "is this command actually hung, or does it just have a lot to do?" are two very different cases. if i didn't already mention this on the list (and it seems that i didn't) it may be because i couldn't decide whether it should be a timeout(1) option or a pv(1) option [https://man7.org/linux/man-pages/man1/pv.1.html]. but given that we don't have pv, and iirc i only learned about it because i was searching around for an answer to _this_ problem, which it doesn't actually solve...
(but, yeah, --long-only is the safe route unless you think you can persuade busybox and/or coreutils to join in the fun.) On Mon, Jul 4, 2022 at 3:28 AM Rob Landley <[email protected]> wrote: > I want a timeout that only kills a command for inactivity (seconds passing > with > no output), and it really seems like a thing "timeout" should be able to > do, and > it's not HARD to implement (pass the output data through a pipe, copy it to > stdout resetting the timer, and use poll() as the timeout mechanism > instead of > timer_settime()). > > That said, people grumble when I add new capabilities that the existing > command > doesn't have, so I thought I'd give a heads up to see if anybody had strong > objections. (No, I am not having it be a --longopt-only; by that logic no > short > option would ever be added again and unix command line is all about short > options.) > > Rob > > P.S. Ok, technically I should do a pty instead of a pipe if output is to a > terminal, but I can't be bothered, -i mode would have that side effect. > And it's > a little awkward having different coeepaths for -i and non -i in the same > command, but... eh? The non-i timeout code's already there, and > xrun()/xpoll() > are already in lib/net.c so it's probably not much new... > > P.P.S. The motivating case here is running "make tests" under mkroot, > where the > qemu instance can take an arbitrarily long time to chug through a bunch of > tests > (emulation is slow, I add more tests all the time, I dunno what > underpowered > wind-up-toy somebody might run this on), but am comfortable saying that if > it's > produced no output for 30 seconds it's hung and should be killed. > _______________________________________________ > Toybox mailing list > [email protected] > http://lists.landley.net/listinfo.cgi/toybox-landley.net >
_______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
