Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: exec'ing $0 in traps
On Fri, 17-Feb-2017 at 12:02:19 -0800, Bart Schaefer wrote:
> On Feb 17, 9:16am, Andre Albsmeier wrote:
> }
> } #!/bin/zsh
> }
> } echo started
> } trap 'echo trapped; exec "$0"' 1
> }
> } echo $$ > /tmp/blafasel
> }
> } while read line; do
> } echo line $line
> } done
>
> Some combination of the "read" builtin plus calling "exec" from inside
> the signal handler is causing the HUP signal to remain blocked across
> the "exec" -- and re-installing the trap doesn't unblock it.
Too bad. Maybe this gets fixed one day. Meanwhile I use this:
#!/bin/zsh
restart=""
echo started
trap 'restart=1' 1
echo $$ > /tmp/blafasel
while :; do
[ $restart ] && exec $0
read line || exit 0
echo line $line
done
and it seems to do what I need...
Messages sorted by:
Reverse Date,
Date,
Thread,
Author