NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: sh won't trap SIGHUP while waiting for jobs



In article <55D6484B.9030109%imca-cat.org@localhost>,
J. Lewis Muir <jlmuir%imca-cat.org@localhost> wrote:
>Hello, NetBSD Users!
>
>I can't get /bin/sh to trap the SIGHUP signal on amd64 NetBSD
>6.1_STABLE.  Does anyone know why?
>
>Here's a test program exhibiting the behavior:
>
>=== test-program ===
>#!/bin/sh
>
>trap 'echo SIGHUP; exit 1' 1
>
>sleep 3600 &
>wait
>====================
>
>I start the test program in one terminal like this:
>
>$ ./test-program
>
>And then in another terminal, I find the process ID, 354 in this case,
>and send it the SIGHUP signal:
>
>$ kill -1 354
>
>Nothing happens; test-program continues running.
>
>If I replace running sleep in the background and waiting with the
>following:
>
>=== test-program-mod ===
>#!/bin/sh
>
>trap 'echo SIGHUP; exit 1' 1
>
>while true; do
>  sleep 1
>done
>========================
>
>It responds to a SIGHUP and exits.
>
>So, is something wrong with the wait command in /bin/sh?

Yes, fixed on HEAD.

Thanks,

christos



Home | Main Index | Thread Index | Old Index