zsh-users
 help / color / mirror / code / Atom feed
* localtraps
@ 2005-04-25  6:35 Vincent Stemen
  2005-04-25 16:32 ` localtraps Bart Schaefer
  0 siblings, 1 reply; 10+ messages in thread
From: Vincent Stemen @ 2005-04-25  6:35 UTC (permalink / raw)
  To: zsh-users

Hi.

I don't seem to be able to get the localtraps option to work.

Here is my test script

<test script>

#!/bin/zsh
# sigtest

signal()
{
    setopt LOCAL_TRAPS
    trap "echo 'executing local signal() trap'" INT
    echo "--- got signal ---"
    sleep 2
}

trap signal INT


for n in 1 2 3 4 5 6
do
    echo -n "."
    sleep 1
done

echo

</test script>


<My expected result>

I expected to see "--- got signal ---" if I hit ^C, then, if I hit ^C
again within 2 seconds, before it exits signal(), I expected to see
"executing local signal() trap".  If I wait at least 2 seconds until I
see another '.' printed, then hit ^C again, I expected to see
"--- got signal ---" again.

</expected result>

On  zsh 4.2.0 (i386-unknown-freebsd5.2.1)
the trap inside signal() seems to have no effect.  Here is what I got

# ./sigtest
.^C--- got signal ---
^C--- got signal ---
^C--- got signal ---
..^C--- got signal ---
..

If I do not set localtraps, then the trap inside signal() works as
expected.

# ./sigtest

^C--- got signal ---
^Cexecuting local signal() trap
.^Cexecuting local signal() trap
.^Cexecuting local signal() trap
..^Cexecuting local signal() trap
.


On zsh 4.2.1 (i386--netbsdelf)
I got a different result with localtraps set.

# ./sigtest
.^C--- got signal ---
^C^Cexecuting local signal() trap
..^Cexecuting local signal() trap
...


As you can see, on 4.2.1 the trap inside signal() works, but the
"setopt LOCAL_TRAPS" has no effect.  It never resets the signal back
when it exits the signal() function.

If I was doing something wrong, I expected to get the same result on
both systems.  Am I overlooking something?

Regards,
Vincent

-- 
Vincent Stemen
Avoid the VeriSign/Network Solutions domain registration trap!
Read how Network Solutions (NSI) was involved in stealing our domain name.
http://www.InetAddresses.net


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2005-04-28  8:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-25  6:35 localtraps Vincent Stemen
2005-04-25 16:32 ` localtraps Bart Schaefer
2005-04-26  0:50   ` localtraps Vincent Stemen
2005-04-26  3:03   ` localtraps Vincent Stemen
2005-04-26 18:34     ` localtraps Peter Stephenson
2005-04-26 22:12       ` localtraps Vincent Stemen
2005-04-27  5:59         ` localtraps Bart Schaefer
2005-04-28  1:00           ` localtraps Vincent Stemen
2005-04-28  8:20             ` localtraps Bart Schaefer
2005-04-27  5:36       ` localtraps Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).