On Sun, May 13, 2018 at 06:57:23PM +0200, Philip K wrote:
> ---
>  st.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/st.c b/st.c
> index 0628707..d5cfd74 100644
> --- a/st.c
> +++ b/st.c
> @@ -824,10 +824,15 @@ ttyread(void)
>       static int buflen = 0;
>       int written;
>       int ret;
> +     pid_t ret_pid;
>  
>       /* append read bytes to unprocessed bytes */
> -     if ((ret = read(cmdfd, buf+buflen, LEN(buf)-buflen)) < 0)
> -             die("couldn't read from shell: %s\n", strerror(errno));
> +     if ((ret = read(cmdfd, buf+buflen, LEN(buf)-buflen)) < 0) {
> +              ret_pid = waitpid(pid, NULL, WNOHANG);
> +              if (ret_pid == pid) /* child is dead */
> +                       exit(EXIT_SUCCESS);
> +              else die("couldn't read from shell: %s\n", strerror(errno));
> +     }
>       buflen += ret;
>  
>       written = twrite(buf, buflen, 0);
> -- 
> 2.17.0
> 
> 

Can you give more explanation what it fixes and how to reproduce it?

Thanks,

-- 
Kind regards,
Hiltjo

Reply via email to