On 12/9/22 08:26, Carl Edquist via GNU coreutils General Discussion wrote: >>> Similar to the situation here, i was seeing things annoyingly look like >>> they are still 'alive' longer than they ought to be when providing >>> input from the terminal. >> >> Huh, I never tried that, honestly. > > Here is a simple example: > > exec 3<> /dev/tcp/example.com/80 > > echo_crlf () { printf "%s\r\n" "$@"; } > > { echo_crlf "GET / HTTP/1.1" > echo_crlf "Host: example.com" > echo_crlf "Connection: close" > echo_crlf "" > } >&3 > > cat <&3 > > In this example, i'm sending the input to the socket (on fd 3) directly > using the 'printf' builtin and shell redirection, and i request the server > close its side of the connection after this request.
This sort of thing is why I added -i to toybox's "timeout" command: -i Only kill for inactivity (restart timeout when command produces output) It runs the command's stdout through a pipe and does a poll() with the -i seconds value, and signals the program if the poll() expires. The android guys found it useful, but I was waiting to hear back about "cut -DF" before bringing it up here... Rob