Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: exec'ing $0 in traps



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.

If I replace the read-loop with

    sleep 3
    kill -1 $$

then the process restarts itself every 3 seconds as expected.

So, you aren't doing anything explicitly wrong.



Messages sorted by: Reverse Date, Date, Thread, Author