<div dir="ltr">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 [<a href="https://man7.org/linux/man-pages/man1/pv.1.html">https://man7.org/linux/man-pages/man1/pv.1.html</a>]. 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...<div><br></div><div>(but, yeah, --long-only is the safe route unless you think you can persuade busybox and/or coreutils to join in the fun.)</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 4, 2022 at 3:28 AM Rob Landley <<a href="mailto:rob@landley.net" target="_blank">rob@landley.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I want a timeout that only kills a command for inactivity (seconds passing with<br>
no output), and it really seems like a thing "timeout" should be able to do, and<br>
it's not HARD to implement (pass the output data through a pipe, copy it to<br>
stdout resetting the timer, and use poll() as the timeout mechanism instead of<br>
timer_settime()).<br>
<br>
That said, people grumble when I add new capabilities that the existing command<br>
doesn't have, so I thought I'd give a heads up to see if anybody had strong<br>
objections. (No, I am not having it be a --longopt-only; by that logic no short<br>
option would ever be added again and unix command line is all about short options.)<br>
<br>
Rob<br>
<br>
P.S. Ok, technically I should do a pty instead of a pipe if output is to a<br>
terminal, but I can't be bothered, -i mode would have that side effect. And it's<br>
a little awkward having different coeepaths for -i and non -i in the same<br>
command, but... eh? The non-i timeout code's already there, and xrun()/xpoll()<br>
are already in lib/net.c so it's probably not much new...<br>
<br>
P.P.S. The motivating case here is running "make tests" under mkroot, where the<br>
qemu instance can take an arbitrarily long time to chug through a bunch of tests<br>
(emulation is slow, I add more tests all the time, I dunno what underpowered<br>
wind-up-toy somebody might run this on), but am comfortable saying that if it's<br>
produced no output for 30 seconds it's hung and should be killed.<br>
_______________________________________________<br>
Toybox mailing list<br>
<a href="mailto:Toybox@lists.landley.net" target="_blank">Toybox@lists.landley.net</a><br>
<a href="http://lists.landley.net/listinfo.cgi/toybox-landley.net" rel="noreferrer" target="_blank">http://lists.landley.net/listinfo.cgi/toybox-landley.net</a><br>
</blockquote></div>