[LTP] [PATCH 1/2] shell: Fix timeout process termination for zsh

Li Wang liwang@redhat.com
Wed May 19 12:29:12 CEST 2021


> I may have something to do with subshells again...
> I just tweaked your reproducer, to be a bit more like our "real
> scenario" and can reproduce it:

Yes, I can reproduce it now.

>
> timeout()
> {
>      sleep 100 &
>      sleep_pid=$!
>      trap "echo Received TERM; kill $sleep_pid; exit;" TERM
>      wait $sleep_pid
>      [ $? -eq 143 ] && echo "FAIL"
> }
>
> timeout &
> pid=$!
> sleep 1
> kill $pid
>
>
> $ bash test.sh
> Received TERM
>
> $ zsh test.sh
> Received TERM
> FAIL
>
> Jörg
>
>


-- 
Regards,
Li Wang



More information about the ltp mailing list